fix sortedkeysdict