Fix redirection of IO streams