minor bug fix in kdtree conditional