Create ref_exists

used by check_ref.py