Fixed a bug in GetChangedStates.