diff --git a/config.lib b/config.lib
index c3ee998ecc..4497cd28dc 100644
--- a/config.lib
+++ b/config.lib
@@ -1799,6 +1799,7 @@ detect_os() {
 					/cygwin/       { print "CYGWIN";  exit}
 					/mingw/        { print "MINGW";   exit}
 					/os\/2/        { print "OS2";     exit}
+					/gnu/          { print "UNIX";    exit}
 			'`
 		fi
 
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index f7b2ee3d8e..b4557232bf 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -61,6 +61,7 @@ void HandleOnEditText(const char *str)
 	switch (_rename_what) {
 #ifdef ENABLE_NETWORK
 	case 3: { // Give money, you can only give money in excess of loan
+		if (!IsValidCompanyID(_local_company)) break;
 		const Company *c = GetCompany(_local_company);
 		Money money = min(c->money - c->current_loan, (Money)(atoi(str) / _currency->rate));
 
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index a57632d951..648a03b35a 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -516,6 +516,7 @@ struct NewGRFWindow : public Window {
 				this->preset = -1;
 				this->SetupNewGRFWindow();
 				this->SetDirty();
+				this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 				break;
 			}
 
@@ -558,6 +559,8 @@ struct NewGRFWindow : public Window {
 				uint i = (pt.y - this->widget[SNGRFS_FILE_LIST].top) / 14 + this->vscroll.pos;
 
 				for (c = this->list; c != NULL && i > 0; c = c->next, i--) {}
+
+				if (this->sel != c) this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 				this->sel = c;
 
 				this->SetDirty();
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index b8bf4bb241..c6079cbcd1 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -336,7 +336,7 @@ static bool FixTTOEngines()
 		255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
 		255, 255, 255, 255,  44,  45,  46, 255, 255, 255, 255,  47,  48, 255,  49,  50,
 		255, 255, 255, 255,  51,  52, 255,  53,  54, 255,  55,  56, 255,  57,  58, 255,
-		 59,  60,   255,61,  62, 255,  63,  64, 255,  65,  66, 255, 255, 255, 255, 255,
+		 59,  60, 255,  61,  62, 255,  63,  64, 255,  65,  66, 255, 255, 255, 255, 255,
 		255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
 		255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
 		255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,  67,  68,  69,  70,
@@ -417,12 +417,12 @@ static bool FixTTOEngines()
 				}
 			}
 
-			e->preview_company_rank = 0;
-			e->preview_wait = 0;
-			e->name = NULL;
-
 			e->info.climates = 1;
 		}
+
+		e->preview_company_rank = 0;
+		e->preview_wait = 0;
+		e->name = NULL;
 	}
 
 	return true;
diff --git a/src/settings.cpp b/src/settings.cpp
index bcf2c49733..6549be66c0 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1379,7 +1379,7 @@ const SettingDesc _settings[] = {
 	SDT_CONDBOOL(GameSettings, vehicle.disable_elrails,                         38, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_SETTING_DISABLE_ELRAILS,        SettingsDisableElrail),
 	 SDT_CONDVAR(GameSettings, vehicle.freight_trains,               SLE_UINT8, 39, SL_MAX_VERSION, 0,NN,     1,     1,     255, 1, STR_CONFIG_SETTING_FREIGHT_TRAINS,         NULL),
 	SDT_CONDBOOL(GameSettings, order.timetabling,                               67, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_SETTING_TIMETABLE_ALLOW,        NULL),
-	 SDT_CONDVAR(GameSettings, vehicle.plane_speed,                  SLE_UINT8, 90, SL_MAX_VERSION, 0, 0,     4,     1,       4, 0, STR_CONFIG_SETTING_PLANE_SPEED,            NULL),
+	 SDT_CONDVAR(GameSettings, vehicle.plane_speed,                  SLE_UINT8, 90, SL_MAX_VERSION, 0,NN,     4,     1,       4, 0, STR_CONFIG_SETTING_PLANE_SPEED,            NULL),
 	SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines,                         95, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_SETTING_DYNAMIC_ENGINES,        ChangeDynamicEngines),
 
 	    SDT_BOOL(GameSettings, station.join_stations,                                               0, 0,  true,                    STR_CONFIG_SETTING_JOINSTATIONS,           NULL),
diff --git a/src/window.cpp b/src/window.cpp
index a1b69e2d7a..b9b42cd617 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -509,12 +509,14 @@ void SetWindowDirty(const Window *w)
 
 /** Find the Window whose parent pointer points to this window
  * @param w parent Window to find child of
- * @return a Window pointer that is the child of w, or NULL otherwise */
-static Window *FindChildWindow(const Window *w)
+ * @param wc Window class of the window to remove; WC_INVALID if class does not matter
+ * @return a Window pointer that is the child of w, or NULL otherwise
+ */
+static Window *FindChildWindow(const Window *w, WindowClass wc)
 {
 	Window *v;
 	FOR_ALL_WINDOWS_FROM_BACK(v) {
-		if (v->parent == w) return v;
+		if ((wc == WC_INVALID || wc == v->window_class) && v->parent == w) return v;
 	}
 
 	return NULL;
@@ -522,13 +524,14 @@ static Window *FindChildWindow(const Window *w)
 
 /**
  * Delete all children a window might have in a head-recursive manner
+ * @param wc Window class of the window to remove; WC_INVALID if class does not matter
  */
-void Window::DeleteChildWindows() const
+void Window::DeleteChildWindows(WindowClass wc) const
 {
-	Window *child = FindChildWindow(this);
+	Window *child = FindChildWindow(this, wc);
 	while (child != NULL) {
 		delete child;
-		child = FindChildWindow(this);
+		child = FindChildWindow(this, wc);
 	}
 }
 
diff --git a/src/window_gui.h b/src/window_gui.h
index bfcb33cbac..bc3242d865 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -380,7 +380,7 @@ public:
 	void DrawViewport() const;
 	void DrawSortButtonState(int widget, SortButtonState state) const;
 
-	void DeleteChildWindows() const;
+	void DeleteChildWindows(WindowClass wc = WC_INVALID) const;
 
 	void SetDirty() const;