Fix error where file.directory did not report changes
Fix #3282
Fix #3317

This fixes it for me @mou, can you double check?