Garry's Mod - bodygroups and collision models are rotated

I’ve been trying to compile the AK-107 rifle model from Arma 2, for Garry’s Mod, with bodygroup support. so far, I am partly successful in doing that.
the problem I am experiencing now, is that bodygroup models and the collision model are rotated, by 90 degrees, in arbitrary directions, in the compiled model.

screenshot of the collision model visualized inside the game:[/t]
while visualized in the 3D editor I use:

screenshots of the bodygroups inside the game:
in the editor:

contents of the QC file I use for compiling:

$scale 1
$modelname "a2_weapons/ak107/ak107.mdl"
$body ak107 "ak107.smd"
$surfaceprop "weapon"
$cdmaterials "models/a2_weapons/ak"
$sequence idle "ak107" activity ACT_IDLE -1.0 loop fps 30
$bodygroup "optics"
	studio "kobra.smd"
	studio "pso.smd"
$collisionmodel "ak107_collision.smd"
	$mass 2.5

I will appreciate any tips that will help me fix these issues.

have you tried parenting your collision models and bodygroups to the base ak mesh?

are your smds rigged to a bone?

it turns out all I needed to do was apply skin modifiers for the collision model and optics.