fixed html parsing and test case bugs