Fixed a bug where stack caches weren't being completely invalidated.