Fixes to the code generator