fixed the thresh problem