Fix nested type serialization