fixed some code to make switch able to compile