fix py3k unicode + sorting keys