Segment support & legacy migration

probably some null safety missing here