Fix a bug in generated classes