fixed 'reversed sign' for thresholds bug (thanks to Sacha Epskamp)