Fix hardcoded threshold bug. Thanks @andrew91386 for bug report.