Serialization bug fixes