fix potential error in html parsing