ensure_dir_exists fix