debug thresholding