Fixes potential issue with redirection of stdout