Add message tests and fix message type creation bug