sofar i have managed to get arround this by repeatedly retrieving and storing data from
commandLogger("/scoreboard players tag @e[type=" .. targetentity .. ",tag=!scanned,c=1] add scanning")
_,result = commandLogger("/entitydata @e[type=" .. targetentity .. ",tag=scanning] {}")
commandLogger("/scoreboard players tag @e[tag=scanning] add scanned")
commandLogger("/scoreboard players tag @e[tag=scanning] remove scanning")
but this is far from optimal