Fix same bug for files as for directories in previous commit