marshalMsg() + tests