Correct the computation of when to add the padding. It is not based on the