Fix bug in cache.py