Prevent overflow for large grids