[MAT-387] Remove accidental double shared_ptr wrapping
[MAT-387] Correct segfault in pinvrunner