cleanup codegen and fix cut