bug fix for #3077, environment settings for script
Merge pull request #3127 from bennojoy/devel

bug fix for #3077, environment settings for script