fix handle_errors