fixed threhsold problem