improve line ending processing: convert CRLF, CR to LF