Fix some bugs in the HTML helper