fix topological_order_packages() when there is a circular dependency (regression of #87, fix #89)