fix crash when missing \n at end of HTML file