Fix state bug