fix fragment length calculation