refactoring: write_error -> print_error