Improved duplicate error detection