Fixed a bug with the caches.