Fix exists check, array elements can be null

Change-Id: I60eb45aac30938f63a5bb62356e0eb5269c45711