correcting sample errors