fix distance validation bug