Fixed the problem of selecting non existing pages and tabs.