Fix some issues with caching