fixed small bugs code gen