Fixed error in detecting mistakes.