fix repeat statement code generation