fix code generation bug