bug fix: forgot a distance check