fixing bugs on the switch and method call