Fix the issue with duplications on the last line