Fixed bug on cache invalidation