Add new ref logic to _get_ref as well