Bugfix grid for x and y direction
Bugfix x and y direction
Bugfix the ii and jj loop limits