Fixed the little bug in topo sort