Fix a bug in refcache