distance treshold : fix the condition