Fix critical bug in the cache system.