add some fixes to CraftCodeGenerator