fix output redirect in script