bug fix in entropy thresholding