Corrected 'thresh' issue