Is there any chance your web server is set to kill the CGIs if they run for more than 60s? If so you'll probably have to increase the limit.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
-- Rick Osborne
Edit by castaway: Closed small tag in signature