minor matrix type check in class dist function