fixes another issue with (for x y) loop on fixed grids.
fixes another issue with (for x y z) loop.