Fix bug with duplicate line insertations