Fixing bugs in grid