improve set tmp env function