update distance field