bugfix for previous commit (distance matrix)