some tweaks to code generation