fixed bug when setting the environment