Fix a cache invalidation bug as reported by andrewkm. Thanks!