Apache2+fcgid = "malformed header from script" when page sta

I was getting some “application failed to start properly” pages, but
production.log was not showing anything.
Looking closer I’ve noticed that server_error.log (the apache log) was
giving lines like:
“malformed header from script. Bad header=: dispatch.fcgi,
referer:”
I was able to determine the cause, and that was that some pages were
starting with a space or a carriage return.
On the other hand, the same pages were throwing no errors when using
Lighttpd+fcgi.
Is this something I could fix in the apache configuration files, so that
I
don’t check every partial render for spaces?
This project was initially on Apache1.3+fcgi and there were no problems.

Bogdan