fix state update