Improving defect detection accuracy