fixed error thresholding