Handle malformed raw HTML more gracefully