Fix a couple of bugs with the segmentation tools.