corrections to distance functions