recv: fix detection logic a bit