fixing bug in delete subsegment