Fix some issues in handling of Custom properties

* Stop writing out empty references to custom props
* Read xml data with empty references to custom items without crashing

Change-Id: I5edffa7061c8720d1d8b4c93daeaf58122f5d9fe