fixed bug preventing used of cache in some situations