Fix in GraphVisitor for serialization of polymorphic objects