Backport simplified logic for back references