Fixed a bug with UpdateGrid.