Fixed thresholding using incorrect parameter
Fixed missing import