Fixed bugs that showed up from threshold feature