kdtree fixing