fix state persistence bug