Added test case to serialize and parse a message and fixed bugs.