Test & fix convertBatch

Note to self: PHP doesn't let you use variables from the outer
function scope inside a func defined eg for array_map