Add test for redirection
Fix output redirection