Fixed detecting newline issue