while-to-if anf back transform added
Fixed local variable name clashes in repeat