Fixing bug that prevented transitioning between states