bug in pseudo code for segmenter