Moved the null check for adding keys and values to Dicts