Fix infinite loop in python3

99% sure this is a bug in OrderedDict.