proper handling of infinit distances
for now workaround #128