fix active tab due to incorrect logic