ensure existence is checked for object before attempting to access properties