Fix cache flushing