fixed issues with stderr redirection