channel: fix race condition in #receive