Bug fixes for the new cachehandling