Fixed saving state bug.