When errors occur during CGI, make sure the error is returned in a
correct CGI reply.