Fixes to caching