Fix bug caused when end of data has been reached for a single line.
Add ignore leading whitespaces option.