Fixes for new thresholding function.