Fixed pointer errors in grid