fixed the grid bug