moved ensure_dir to utils