refactoring fixup/fixupHtml