Fixed bug in cache