get_ref/set_ref asymmetry will cause swap_ref fail, should redesign the interface.