fixing bugs with codegenerator