make api_friendly_ref_type work in all cases