fixed foldersort function.