rename nested control variable 'i' to 'j'

There is already a control variable 'i' in the outer loop.
Avoid confusion and fix compiler warnings.