Fix issue with pane switching