(#215) pass a clone of the doc to mapFun