Restore id
Add some exception checks