Updated stderr and stdout handling.