fixing nearest segmentation node search for getting the context