update distance table entries only if larger than 0.