fix prepareThreshold bug