Some fixes to HTML code generation