changes to KdTree.nearest()