misc fixes to allow some examples to compile

Compiled and runtime-tested some fcgi examples (and cgi/hello_world), these are the changes i had to apply to make them behave.
Please consider merging.
thanks,