fix defaultdict call

In Python 2.7, the current version fails with:

$ python -c 'from collections import defaultdict; defaultdict(None)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: first argument must be callable
Merge pull request #3240 from JelleZijlstra/fix-defaultdict

FIX defaultdict call for some Python versions