env_dir in function