Fixed caching logic