added an error message for invalid distance matrices