code generation bug fixed