update distance