Bug in distance matrix fixed