improved AbstractSegment::sanitizeValue method