fix reset & restore state