race condition fixed
selected is the second tab