serialization of nested types