bugfix on output redirection