Partly backport the change in ecell-3.3 branch