Some fixes to prim op etc