Added test and detection of invalid lines