fix grid functions