fix some grid and drag operation bugs