Fix crashes during parsing and add <img> to test1.html to test.