Fix bug in cache