fix syntax and CGI header bugs