fix code generation issue with primary type args; implement #167