Added syncing of messages to force waiting for all messages 

instead of race condition.