Fix for nearby distance calculation.

Change-Id: I54ea2e785cb744d5d82393d462b0f8ba9c04db89