deletes the stateswitches correctly