fixing a concurrent modification issue in PartitionContext
fixing recursive call when terminating cluster/group