Properly save/restore instance state