errors in segmentation fixed