changed serialization visitors to use getElementType in AbstractVisitor