Some bug-fixes for discovery