More thought out fixes for melt_sample_matrix and friends, first problem was upstream and I didn't notice.