some fixes to serialization