Bone updates are too late in animation

I created the following scripts which are intended to play animations and fix bone positions so
that animation is played in place. It is not complete yet, but I have a problem with this code.

Bone update/animation script:

package arm;
import iron.object.BoneAnimation;
import iron.data.SceneFormat.TObj;
import iron.math.Mat4;
import iron.math.Vec4;
import iron.object.Object;

// RootMotion.hx - handles bone
class RootMotion extends iron.Trait {
	var anim: BoneAnimation;
	var bone: TObj;
	var action: String;
	var rbname: String;
	function findAnim(obj: Object)
	{
		for (c in obj.children) {
			if (c.animation != null) {
				anim = cast(c.animation, BoneAnimation);
			}
		}
		if (anim != null)
			return;
		for (c in obj.children) {
			findAnim(c);
			if (anim != null)
				break;
		}
	}
	public function update_anim(playback:String)
	{
				anim.play(playback, null, 0.2);
				action = anim.action;
				bone = anim.getBone(rbname);
				trace(action);
				var tm:Mat4 = anim.getBoneMat(bone);
				anim.notifyOnUpdate(function() {
					tm.setLocation(Vec4.zero());
				});
	}

	public function new(rootbone: String) {
		super();
		trace(rootbone);
		rbname = rootbone;
		
		notifyOnInit(function() {
			findAnim(object);
			if (anim != null) {
				update_anim("Default");
			}
		});
	}
}

Player control script:

// PlayerMotion.hx - player control script
package arm;
import iron.system.Input;
import iron.system.Time;
import iron.object.Object;
import iron.object.BoneAnimation;
import arm.RootMotion;

class PlayerMotion extends iron.Trait {
	var anim: BoneAnimation;
	var rm: RootMotion;
	function findAnim(obj: Object)
	{
		for (c in obj.children) {
			trace("t0 " + c.name);
			if (c.animation != null) {
				trace("t1 " + c.name);
				anim = cast(c.animation, BoneAnimation);
				if (anim != null)
					trace("t2 " + c.name);
			}
		}
		if (anim != null)
			return;
		for (c in obj.children) {
			findAnim(c);
			if (anim != null)
				break;
		}
	}
	public function new() {
		super();

		notifyOnInit(function() {
			findAnim(object);
			if (anim == null)
				return;
			anim.play("Default");
			rm = object.getTrait(RootMotion);
		});
		notifyOnUpdate(function() {
			if (anim == null)
				return;
			var kbd = Input.getKeyboard();
			if (kbd.down("w")) {
				rm.update_anim("man-walk01");
			} else {
				rm.update_anim("Default");
			}
		});
	}
}

The problem I have is that bone update happens too late, so when animation changes I can see a few frames of unmodified animation, then I see animation with a bone properly set to 0. Any ideas?
The animationman-walk01 was created with character walking on surface, not in place (imported from mocap and retargeted), and the script RootMotion.hx is intended to move toplevel bone to 0 (will also use bone position to put RigidBody there). But the action of setting bone to 0 seems to be applied with delay of several frames which produce artifacts during animation change (character starts walking away from player and then snapped to origin position and after that works as intended).

Are you able to paste some pre-set project? Would like to tinker with that and look for a fix.

Well forum does not allow me to paste zips…

OK, created github issue and uploaded file there: