set errors correctly for validation failure