Change id to index.
Set perm_id's.