Bone Local Axis Orientation in custom AnimNode

So I’m currently working on a realtime multi-bone IK AnimNode, using the FABRIK approximation algorithm. This particular algorithm calculates positions for the bones, and you then re-orient the local rotation axis so that the bones affected continues to ‘point’ towards their children afterwards. For that purpose I’m using the following code:

//PendingTransforms contains an array of the bone transforms that the anim node is currently updating, because I need to calculate the rotations after the bones have reached their final positions for this update
FVector const OldDir =  FMatrix::Identity.GetUnitAxis(EAxis::X);
FVector TargetLoc = PendingTransforms[i+1].Transform.GetLocation();
FVector  NewDir = (TargetLoc - PendingTransforms[i].Transform.GetLocation()).SafeNormal();
FVector Axis = FVector::CrossProduct(OldDir, NewDir).SafeNormal();

float RotationAngle = FMath::Acos(FVector::DotProduct(OldDir, NewDir));
FQuat DeltaRotation =  FQuat(Axis,RotationAngle);
PendingTransforms[i].Transform.SetRotation(DeltaRotation );

This works fine to orient the local X axis towards the child, but I’m also getting rotation around the local X axis like the following:

You can see how on the middle finger the Z axis is pointing left, with reference to the camera, and the Y axis is down, but on the index finger, which is the one being driven by the AnimNode at present, I’ve got rotation around the local X such that Z now points towards the camera.
Is there something I’m not doing, which would constrain the calculated rotation so that I don’t affect my local Z axis, or a different method to calculate the rotation around the local Z axis instead which would effectively do the same?

Changed code to use

OldDir =  PendingTransforms[i].Transform.GetRotation().GetAxisX();


DeltaRotation *PendingTransforms[i].Transform.GetRotation());

and all is working now. Thanks to Rama for helping out with the DrawDebug functions - that was how I finally solved this.