Nested discovery fixes

Sorry for the lack of tests.  Hopefully I'll get to this tomorrow.