Add save/restore for tests/serialization