fixed minor bugs in caching system