more robus primary pane detection