Fix crash when replacing parent context for new confinement context