Fix issue when dealing with HTML files with multiple root elements