Why does adding an 'if' effect my state machine?

Actually, in this case:

if (walk == 0) {
...
}
else
{
...
}