Fixed some bugs with the quadtree