Replacing null namespaces with empty dictionaries