#ACT-1426: Nested multi-instance activities did not work

This fixes nested multi-instance activities, including a test case.

Was originally reported as ACT-1426. The patch is exactly what the reporter proposes.