when using createGrid(grid) make sure the grid is exactly the same size no rounding.