fix bug of getting wrong answer in a few cases
add new tab index