Fix bugs in CacheManager class