Fixed bug where test env not being set correctly