Prim Matrix fix