couple of fixes to the html parsing logic