Fixed bug when it changes the selected tab