fix change state bug