fixing change_tab function