bug in topo_update. cycle changed to exit in final loop