small fix to get grid searching functional
attempt to fix memory leak