the duration of segments was computed erroneously, since it was taking into consideration the last track only. Now the duration of a segment corresponds to the maximum duration among all tracks.