Added a checks to make sure object property exists before assigning the property's value.