Fixed changeCurrentState to wait(1) after the state is changed