I've got the following code, which should work out 2 new vectors after the collision of 2 circles

ball1x = ball1._x;
ball1y = ball1._y;
ball2x = ball2._x;
ball2y = ball2._y;
distx = ball1x-ball2x;
disty = ball1y-ball2y;
hy = Math.sqrt((distx*distx)+(disty*disty));
if (hy<radius*2+4) {

normalX = distx/hy;
normalY = disty/hy;
Vector1 = ball1.xmove*normalX+ball1.ymove*normalY;
Vector2 = ball2.xmove*normalX+ball2.ymove*normalY;
Vector3 = Vector1-Vector2;
dv0 = -0.9*Vector3;
dv1 = 0.9*Vector3;
ball1.xmove += normalX*dv0;
ball1.ymove += normalY*dv0;
ball2.xmove += normalX*dv1;
ball2.ymove += normalY*dv1;


but for some reason, the above code works sometimes and the 2 circles bounce away more or less corectly, but other times, the faster moving circle will become "stuck" with the other circle, move around the edge of the circle and then move away from it
are the new vectors not being correctly calculated with the above code, and is that creating this problem?

thanks for any help