Fixed some bugs in html parsing