FIXED bug with keys and cache flushing