fixed lines_to_routes memory issue