edited the environment detecting