change index when tab is moved