Most notably fixes a crash that might happen if contents of subdirectories changed
Merging this now as the commits contain no dangerous changes, and also fixes a crash (although most likely noone but me has experienced it).
Merging this now as the commits contain no dangerous changes, and also fixes a crash (although most likely noone but me has experienced it).