fixed not switching state when the inputs of the two states are the same