Fix issues with stdout/stderr