Improve portability of "environment" test

The "environment" test was failing on ubuntu 12.04.