fix state machine logic, derp