added sanity check on return from recv callback