Fix up distance calc