Handling grids which may have a zero-size dimension.