fix bug in cache