use valueForKeyPath and added safety check to addWithDictionary

use valueForKeyPath to enable input dictionaries that need to access nested values
added a check for nil and NSNull in addWithDictionary