code generation improvements