Add baseZIndex, fix handling of empty document fields