Fix several HTML generation bugs

This fixes three open issues for HTML rendering bugs.