Fixed a race in the message queue.