Smaller bug fixes around caching