Fix crash-bug when inserting lines