fix generation code