Coerce Error in APOC.create.vNode

Hi,

Objective: I have a bunch of patents that I have done louvain clustering on and have written the cluster id as property. There are word relationship to the patents and I want to aggregate them to the cluster id.

following an example from this Neo4J and Virtual Nodes/Relationships - DZone Database

I have crafted this cypher code

Match (n:patent)-[r:In_abstract]-(a:word)
With n,r,a
where n.self_louvain>=0
With Collect(distinct toString(n.self_louvain)) as clusters
With [cnum in clusters | apoc.create.vNode(['clusterID',{num:cnum}])] as cNodes
WITH apoc.map.groupBy(cNodes, 'num') AS cnc
Match (n:patent)-[r:In_abstract]-(a:word)
WITH n,r,a,cnc
where n.self_louvain>=0
return cnc, apoc.create.vRelationship(cnc[toString(n.self_louvain)],'In_cluster',{total:count(r)},a) as rel

The louvain properties are integers and I have tried with and without coercing them to strings directly.
It is returning this error.
Wrong argument type: Can't coerce Map{num -> String("2")} to String

Note there are nodes with a louvain value of of 2 (as an integer).

if I remove the tostring and use this:

Match (n:patent)-[r:In_abstract]-(a:word)
With n,r,a
where n.self_louvain>=0
With Collect(distinct n.self_louvain) as clusters
With [cnum in clusters | apoc.create.vNode(['clusterID',{num:cnum}])] as cNodes
WITH apoc.map.groupBy(cNodes, 'num') AS cnc
Match (n:patent)-[r:In_abstract]-(a:word)
WITH n,r,a,cnc
where n.self_louvain>=0
return cnc, apoc.create.vRelationship(cnc[n.self_louvain],'In_cluster',{total:count(r)},a) as rel

It returns an error:
Wrong argument type: Can't coerce Map{num -> Long(2)} to String

Where have I gone wrong?
Andy