correctly initialize error_code