fixed a horrible bug that would not check for the final threshold of a detection