Update Existing Rebars not working

I’m currently using the BIM4Struc package to model few rebars in the walls. Find the snip below:

The issue is that, i cannot seem to modify the rebar which has already been modelled using this script. When i set the boolean value to False and run it, there are new set of rebars which are modelled which results in duplication of rebars in the element.

I tried to snoop in a bit into the custom node and this was the Python code used for creating/modifying the rebars.

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference("System")
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
host = UnwrapElement(IN[0])
bartype = UnwrapElement(IN[1])
vector=IN[2]
#Toggle that indicates if a new element has to be created
new=IN[3]

TransactionManager.Instance.EnsureInTransaction(doc)
# Get the host analytical profile whose curves will define the boundary of the the area reinforcement 
analytical = host.GetAnalyticalModel()
if not analytical:
    rebar= "The selected element can't \nhost Area Reinforcement"

else:  	
	#define the Major Direction of AreaReinforcement,
	#if there is no Major Direction given in the inputs, then take the direction of the first curve of the floor/wall sketch.
	if vector is None:
		curves = analytical.GetCurves(AnalyticalCurveType.ActiveCurves)
		firstLine = curves[0]
		majorDirection = XYZ(
	    	firstLine.GetEndPoint(1).X - firstLine.GetEndPoint(0).X,
	    	firstLine.GetEndPoint(1).Y - firstLine.GetEndPoint(0).Y,
	    	firstLine.GetEndPoint(1).Z - firstLine.GetEndPoint(0).Z)
	#else use the given vector
	else:
		majorDirection=vector.ToXyz()

	#Obtain the default Area Reinforcement Type
	defaultAreaReinforcementTypeId = doc.GetDefaultElementTypeId(ElementTypeGroup.AreaReinforcementType)
	if str(defaultAreaReinforcementTypeId) == "-1":
		rebar= "There is no Area Reinforcement Family Type \ndefined in the Revit project"
	else:
		#Set the default Hook Type to none
		HookTypeId = ElementId.InvalidElementId
		try:
			rebar = AreaReinforcement.Create(doc, host, majorDirection, defaultAreaReinforcementTypeId, bartype.Id, HookTypeId).ToDSType(new);
		except:
			rebar= "The Area Reinforcement could \nnot be created"

#Assign your output to the OUT variable

TransactionManager.Instance.TransactionTaskDone()

OUT=rebar

I am very new to Python and to me, It seems as though the modify condition has not been well defined in the python script?

Have you find a solution?