Copied phases with parallel/sequential groups (w phaseApi.addPhase) cannot be proceeded


Ref. to How to copy a task from one template to another? , I try to copy phase from a template XLR to my release with the following jython code snippet.
It works for normal tasks. But if the copied phase has either sequential or parallel group. The tasks inside the group cannot be proceeded but keep “In progress” forever and I even cannot abort them. I am using XLR v9.0.4 Any help on this?

XLR_TPL_ID = “Applications//Releaseb80c0971244344828e50bacbf9fd48c9”

#Search phase by title {phase} in Template: releaseVariables[‘XLR_TPL_ID’]
p=phaseApi.searchPhasesByTitle(XLR_TPL_PH, XLR_TPL_ID)
phasetocopy = phaseApi.getPhase(str(p[0]))
#phasetocopy.title = releaseVariables[‘LST_PHASE’][phase]
addnewphasedest = phaseApi.addPhase(getCurrentRelease().id, phasetocopy)

for task in phasetocopy.tasks:
taskApi.addTask(, task)