Fixed some minor bugs related to caching.