minor improvements in topology.py