corrected IState-Switch-Code