Add some bounds checking to the grid.Index method.