Fixed histogram function in thresholding_functions