general: defaultdict fix

(addresses #2030)

Signed-off-by: Eirini Psallida <eirini.psallida@cern.ch>