fix grid handling