Proper serialization; fix deserialization also
Merge