fix infinite distance