Fix minor bug for generating nested complex types