fixing operation of script/envois

Made changes Stephen and I discussed yesterday. See commit message for more info.