Use error_msg instead of fprintf(stderr