corrected nnet_thres function