fixed edge case where the error class was not removed correctly after manually checking validity