corrected svm_thres function