bugfix-NewCodeGen

Fixes for new version of codegen