fixed to use thresh from peakthresh