Fixes to second index performance improvements
A couple of fixes to commit 2872008f :
- Add missing code to add directory monitors for non-changed directories
- Avoid some pointless caching non-direct children of a changed folder, as those need their own checks
Plus a couple of somewhat unrelated memory leak fixes.