refactor validation errors