Fixed bug with leftover line handling