pass env_dir to function