fixed grid segfault (i think)