avoid attempt to insert nil object into dictionary