Fixed the threshold bug.