Fixed multithreading bug in the message processing.