tarjan not working properly