fixed potential AttributeError when no img tag was found in html