bugfix for switch & improved sys2.c