Fixed a sorting issue when processing the parent directories.