bug fix for #3077, environment settings for script