recover state on termination