Fixed bug on offset definition in distance matrix.