sorted dictionary wrong