properly handle a corner case and fix a race condition by checking req->done before looking for pending output
just a debug message