improve safeguard in cache_mng_rm_cache_dir()