threshold bug fix
Merge pull request #306 from jpecht/master

threshold bug fix