Fix errors due to changed distances interface.