adding a check for cache directory