Minor fixes to serializiation