fixed count error in code generator