#2 change index when attach & detach tab