Using camera zooming and center object fails.

I am probably doing something horribly wrong, but I can't see what i'm doing wrong. I tried different methods, but everytime I change the scale of the camera the object is not centered anymore, but rather sliding to the right or left (and up and down). So how do I create proper scaling?

This is the code i'm using right now to create a camera, following an object:

Code:
dx = ((Main.STAGE.stageWidth / 2) / scale) - (follow.body.GetWorldCenter().x * Main.WORDSCALE);
dy = ((Main.STAGE.stageHeight / 2) / scale) - (follow.body.GetWorldCenter().y * Main.WORDSCALE);
var m:Matrix = canvas.transform.matrix;
         
m.identity();
m.translate(-dx, -dy);
m.scale(scale, scale);
m.translate(dx, dy);

canvas.transform.matrix = m;



If anyone can help me with this, because i'm completely stuck...
Fixed

Code:
dx = (Main.STAGE.stageWidth / 2) - (follow.body.GetWorldCenter().x * Main.WORDSCALE * scale);
dy = (Main.STAGE.stageHeight / 2) - (follow.body.GetWorldCenter().y * Main.WORDSCALE * scale);

Original thread: https://box2d.org/forum/viewtopic.php?t=5484