why this complex machism to get the seg? can't you use a random slice of the data? it should work whatever the value of seg right?