refactor error messages