bug computing transformation matrix relative to parent

Hello,

I have to compute the transformatin matrix of a bone relatively to its parent.
I can't use "in coordsys parent" anymore because I need to do some computations on the transformation matrix, but I left out this computations for the moment because I didn't manage to compute the correct transformation matrix relative to the parent.
"in coordsys parent myBone.transform" returns the world transform matrix (strange?), so I noticed the problem by the extracted rotation quaternion which is not correct.

The code I used before:

local myPosition = in coordsys parent myBone.position
local myRotation = in coordsys parent myBone.rotation
local myScale    = in coordsys parent myBone.scale

The code I use now:

local myBoneTransform = myBone.transform
 
if (myBone.parent != undefined) then
(
    myBoneTransform = myBoneTransform * (inverse myBone.parent.transform)
)
 
local myPosition = myBoneTransform.position
local myRotation = myBoneTransform.rotation
local myScale    = myBoneTransform.scale

I should obtain the same results in old and new code. But that's not the case!

What am I doing wrong?