Fixed the isOnRoute() function.