dont write over the end of ref_cache