Fixed a state transition and also fixed first_run logic