Check if property exists before accessing or setting it

Previously when accessing/setting a property which does not exist,
there will be segmentation faults