check object before access a property