fixes to serialization