Remove race conditions in message_stream