improve KdTree nearest()