debugged the switch