Added support for serialization of regular types (not only anonymous types)