Process instance Modification throws Optimistic locking exception

Hi,
I have suspended the process instance and before activate i would like to modify the process instance. The modification involves moving token a activity before where it is suspended. I get optimistic locking exception. Could someone help me with this?

ActivityInstance ai = runtimeService.getActivityInstance(piId);
runtimeService.createProcessInstanceModification(piId)
.startAfterActivity(ai.getActivityId()).execute();
runtimeService.activateProcessInstanceById(piId);

@Sowmiya can you upload your bpmn file? and in which activity you are starting at?

infinite.bpmn (4.1 KB)

Did you find a solution to this problem? I seem to be having a similar problem with process instance modification.