Fixed a concurrency crash when receiving messages.