fix a bug in segmenting
fix a bug in segmenting