minor changes to serialization logic