fixed bugs in html functions