Several bugfixes and speed improvements related to the delayed storing of directories.
Bugfix in Directory.
Merge remote-tracking branch 'origin/bugfix' into next