Return a copy of a ter_id instead of a reference to avoid crashing.