Improved handling of header line errors