refactor errors.