First lot of fixes for the caching