Fixing example with element collections to use `getObject`