Fix for doSwitch