fix bugs with cache evicting