added support for nested polymorphic classes serialization