Fixed bug with setting the environment