Fixing a dir sorting issue that caused a crash