Fixed bug in caching.