#6494: Code and SQL for fixing htmlpages