bug fixing of get_dn_ds_matrix()