more caching improvements and fixes