Changed the detection of errors