Use the correct error codes
Correctly set hasErrors