fixed inserting nil into dictionary