Added sorting for permissions in flatfile format.