Fixed bugs with get_sub_mat() being passed in shared matrices