Applying jtwigg's fix for pin joints.