Fixed some bugs to get the rendering of 2d grids working