fix bugs in grid