partially moving caching from cache_latest branch
minor caching related fixes
fixing a typo