Fix stdout/stderr handling.