fixed infinite loop due to lines that didn't have any whitespace