Fix deserialization for inheritance