fixes major bug in topology.py