Hi Alex,
I found an issue with the history variables, the following is from the source code:
// this is a process instance
HistoryEvent.fire(new ProcessInstanceEnd(), this);
fire(Event.END, getProcessDefinition());
Only ProcessInstanceEnd event is fired. So all variables are deleted, is it right?