switching state change listener