Fix bug in circular string segmentation