enumeration: Fix bug in set_index.