fix kdtree