Fix crashes of ObjectRef api function when no string supplied