Added unit tests for message fields and fixed bugs.