Fixed processing of messages. fixes #10