topological_sort: Fixing error reporting when there are two packages with the same name