Fix bug with caching