added check to pane switch when pane is hidden