fix tarjan algorithm