Fixed escapeForEach and nextIteration to work with forEach loops - were not previously working because a forEach commands are converted to while commands before code is generated.