Cgi html fixes to match static html part 2

This branch is work in progress, to get cgi-html on 2.1.x more like the static version.