Fixes to discovery.py