Fixed AI not updating the state