Fixed a few bugs in the new HTML generation code.