fixed Topological_sorting