Fixes to HTML output conversion