Bugfixes and speedup for directories with a lot of files.