1) fixed memory leaks

2) reading if quadtree should be used from xml file