Fixed nested for loop variables