The way in which $N is used in the generated SystemCode will
fail in a nested loop.  Use a different variable each time.
