Bug fix with OrderedDict