Fix default implementation for distance