Fix problem with duplicated lines