Fix bug in caches