Fixed a bug in caching.