fixes maxDist constraint