fixed collision checking for grids