Process Instance Modification with parallel gateway

I have a simple process with parallel gateway. When I use the Process Instance Modification api to move the process back to one of the task within the parallel fork and merge gateway the process gets stuck at the merge gateway. I have attached a simple bpmn. Here is the scenario. The process is at Task C. Task B and Task D are completed. At this state I moved the process back to start before Task B and canceled Task C. After the modification Task B becomes active as it should, once it is completed Task C is active. So far everything is working as expected. Now when the Task C is completed the process does not move to Task E. Since the Task D was completed before the modification happened it looks like the engine looses the fact that it was already completed and waits on that flow to complete before moving out of the join gateway. Is there anything I can do in this scenario to make the process continue? The only option I found is to bring the process back to the parallel gateway again and let everything start from there.Parallel_Flow_ProcessModification.bpmn (6.6 KB)

When moving the token back you need to create two tokens to ensure that process can satisfy the merging gateway - which is expecting 2 tokens.
So i would suggest creating one token on the task you want to repeat and a second token on the merging gateway.