fixed bug in cache handling