guarding stdout/stderr to work with #4