Fix max distance