Fix to bug in chain demotion code