Modified environment logic. Fixes bug 7695
Merge pull request #13 from pguttmann/master

Modified environment logic. Fixes bug 7695