Fixed bug and created unit tests for message_dispatcher