Fixing the error in finding the leaving point on the orbit