fix cache flushing