make onopenobject and onopenarray a bit more generic