Modified try/catch in swtichTabs