added a MAX_SEG option