How to make a dynamic body static

Hi!

I cannot seem to figure this out. I have in my game static boxes that become dynamic at a certain point in the game. I make the dynamic boy just calling setMassFromShapes() on the bdies. However, I cannot seem to make the bodies static again. I try to do this with the follwing code.

MassData md = new MassData();
md.mass = 0.0f;
md.I = b.getInertia();
md.center = b.getLocalCenter();
b.setMass(md);

I am using jBox2D, but you probably get the point even if you use C++. If I do this, and then collide with one of the objects, the colliding objects position gets set to (NaN, NaN), so there is apparently something I am doing wrong here...

Any ideas?
Argh, now it works as long as I set all properties of the mass data to zero. Thanks anyway.

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