Fixed check_retval logging