Moar edge cases in manifest_gen.sh.

I screwed up the recursion on the last push too. Test test test.