Fixed bug introduced in last commit where Tab logic sometimes failed and fixed bug where Tabs sometimes close