Fix defaultdict bug