Fixed bug with drawing of grid.