Fixed bug in calc_generalized_inertia()