diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx
index 957243566..fa851e0ca 100644
--- a/src/AIModel/AIAircraft.cxx
+++ b/src/AIModel/AIAircraft.cxx
@@ -528,7 +528,7 @@ bool FGAIAircraft::loadNextLeg(double distance) {
     } else {
         double cruiseAlt = trafficRef->getCruiseAlt() * 100;
 
-        fp->create (this,
+        bool ok = fp->create (this,
                     dep,
                     arr,
                     leg+1,
@@ -542,6 +542,10 @@ bool FGAIAircraft::loadNextLeg(double distance) {
                     acType,
                     company,
                     distance);
+
+        if (!ok) {
+            SG_LOG(SG_AI, SG_WARN, "Failed to create waypoints for leg:" << leg+1);
+        }
        //cerr << "created  leg " << leg << " for " << trafficRef->getCallSign() << endl;
     }
     return true;
diff --git a/src/AIModel/AIFlightPlanCreateCruise.cxx b/src/AIModel/AIFlightPlanCreateCruise.cxx
index b8caf608e..c8c721084 100644
--- a/src/AIModel/AIFlightPlanCreateCruise.cxx
+++ b/src/AIModel/AIFlightPlanCreateCruise.cxx
@@ -296,6 +296,10 @@ bool FGAIFlightPlan::createCruise(FGAIAircraft *ac, bool firstFlight, FGAirport
   const string& rwyClass = getRunwayClassFromTrafficType(fltType);
   double heading = ac->getTrafficRef()->getCourse();
   arr->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway, heading);
+  if (!arr->hasRunwayWithIdent(activeRunway)) {
+      return false;
+  }
+
   FGRunway* rwy = arr->getRunwayByIdent(activeRunway);
   assert( rwy != NULL );
   // begin descent 110km out
diff --git a/src/Airports/airport.cxx b/src/Airports/airport.cxx
index 0e1fbc443..c6d3ec920 100644
--- a/src/Airports/airport.cxx
+++ b/src/Airports/airport.cxx
@@ -408,7 +408,7 @@ void FGAirport::addLineFeature(FGPavementRef linefeature)
 //------------------------------------------------------------------------------
 FGRunwayRef FGAirport::getActiveRunwayForUsage() const
 {
-  FGEnvironmentMgr* envMgr = (FGEnvironmentMgr *) globals->get_subsystem("environment");
+  auto envMgr = globals->get_subsystem<FGEnvironmentMgr>();
 
   // This forces West-facing rwys to be used in no-wind situations
   // which is consistent with Flightgear's initial setup.
diff --git a/src/Airports/dynamics.cxx b/src/Airports/dynamics.cxx
index 6280ddc7d..95564e4df 100644
--- a/src/Airports/dynamics.cxx
+++ b/src/Airports/dynamics.cxx
@@ -845,7 +845,7 @@ void FGAirportDynamics::getActiveRunway(const string & trafficType,
                                         double heading)
 {
     bool ok = innerGetActiveRunway(trafficType, action, runway, heading);
-    if (!ok) {
+    if (!ok || runway.empty()) {
         runway = chooseRunwayFallback();
     }
 }
@@ -853,7 +853,13 @@ void FGAirportDynamics::getActiveRunway(const string & trafficType,
 string FGAirportDynamics::chooseRunwayFallback()
 {
     FGRunway *rwy = _ap->getActiveRunwayForUsage();
-    return rwy ? rwy->ident() : std::string();
+    if (!rwy) {
+        SG_LOG(SG_AI, SG_WARN, "FGAirportDynamics::chooseRunwayFallback failed at " << _ap->ident());
+
+        // let's use runway 0
+        return _ap->getRunwayByIndex(0)->ident();
+    }
+    return rwy->ident();
 }
 
 double FGAirportDynamics::getElevation() const