added polymorphic serialization