Modified diag_mx_seq_take_min