Wrong average pace

For timed activities, the calculated average pace for the whole activity is wrong because it includes the last line as a whole kilometer, whereas it's often much less. How can I fix this ?