added correct point distance checking