filled in error_msg function