Fixed caching bugs.