Improve redirecting for backgrounded programs.