Fix delay (the variable for state name collided with the function to modify the state)