fixed bug when filling grids