Fix bug with tab selection