issue #7 (incorrect saving of segment boundaries) fixed