diff --git a/package/mac/build-mac-nightly-dmg.rb b/package/mac/build-mac-nightly-dmg.rb
index 21290ec03..21b9e47ba 100755
--- a/package/mac/build-mac-nightly-dmg.rb
+++ b/package/mac/build-mac-nightly-dmg.rb
@@ -4,19 +4,24 @@ require 'ERB'
 
 $osgLibs = ['osgFX', 'osgParticle', 'osg', 'osgGA', 'osgText', 'osgUtil', 'osgSim', 'osgViewer', 'osgDB']
 $osgPlugins = ['ac', 'osg', 'freetype', 'qt', 'imageio', 'rgb', 'txf']
-$osgDylibVersion='63'
+
+osgVersion = `./run-osgversion --version-number`
+puts "osgVersion='#{osgVersion}'"
+$osgSoVersion=`./run-osgversion --so-number`
+$openThreadsSoVersion=`./run-osgversion --openthreads-soversion-number`
+
 $alutSourcePath='/Library/Frameworks/ALUT.framework'
 
 def fix_install_names(object)
   #puts "fixing install names for #{object}"
   
   $osgLibs.each do |l|
-    oldName = "lib#{l}.#{$osgDylibVersion}.dylib"
+    oldName = "lib#{l}.#{$osgSoVersion}.dylib"
     newName = "@executable_path/../Frameworks/#{oldName}"
     `install_name_tool -change #{oldName} #{newName} #{object}`
   end
   
-  oldName = "libOpenThreads.12.dylib"
+  oldName = "libOpenThreads.#{openThreadsSoVersion}.dylib"
   newName= "@executable_path/../Frameworks/#{oldName}"
   `install_name_tool -change #{oldName} #{newName} #{object}`
   
@@ -38,7 +43,7 @@ contents=bundle + "/Contents"
 macosDir=contents + "/MacOS"
 frameworksDir=contents +"/Frameworks"
 resourcesDir=contents+"/Resources"
-osgPluginsDir=contents+"/PlugIns/osgPlugins-2.9.7"
+osgPluginsDir=contents+"/PlugIns/osgPlugins-#{osgVersion}"
 volName="\"FlightGear Nightly Build\""
 
 puts "Creating directory structure"
@@ -56,18 +61,18 @@ end
 
 puts "copying libraries"
 $osgLibs.each do |l|
-  libFile = "lib#{l}.#{$osgDylibVersion}.dylib"
+  libFile = "lib#{l}.#{$osgSoVersion}.dylib"
   `cp #{prefixDir}/lib/#{libFile} #{frameworksDir}`
   fix_install_names("#{frameworksDir}/#{libFile}")
 end
 
 # and not forgetting OpenThreads
-libFile = "libOpenThreads.12.dylib"
+libFile = "libOpenThreads.#{openThreadsSoVersion}.dylib"
 `cp #{prefixDir}/lib/#{libFile} #{frameworksDir}`
 
 $osgPlugins.each do |p|
   pluginFile = "osgdb_#{p}.so"
-  `cp #{prefixDir}/lib/osgPlugins-2.9.7/#{pluginFile} #{osgPluginsDir}`
+  `cp #{prefixDir}/lib/osgPlugins-#{osgVersion}/#{pluginFile} #{osgPluginsDir}`
   fix_install_names("#{osgPluginsDir}/#{pluginFile}")
 end
 
diff --git a/package/mac/run-osgversion b/package/mac/run-osgversion
new file mode 100755
index 000000000..508b07bf1
--- /dev/null
+++ b/package/mac/run-osgversion
@@ -0,0 +1,4 @@
+#/bin/bash
+DYLD_LIBRARY_PATH=$PWD/dist/lib
+./dist/bin/osgversion $1
+
diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx
index f8374bb35..e3b6be0c0 100644
--- a/src/Main/fg_commands.cxx
+++ b/src/Main/fg_commands.cxx
@@ -1211,23 +1211,15 @@ do_play_audio_sample (const SGPropertyNode * arg)
 static bool
 do_presets_commit (const SGPropertyNode * arg)
 {
-    // unbind the current fdm state so property changes
-    // don't get lost when we subsequently delete this fdm
-    // and create a new one.
-    globals->get_subsystem("flight")->unbind();
-
-    // set position from presets
-    fgInitPosition();
-
-    fgReInitSubsystems();
-
-#if 0
-    if ( ! fgGetBool("/sim/presets/onground") ) {
-        fgSetBool( "/sim/freeze/master", true );
-        fgSetBool( "/sim/freeze/clock", true );
+    if (fgGetBool("/sim/initialized", false)) {
+      fgReInitSubsystems();
+    } else {
+      // Nasal can trigger this during initial init, which confuses
+      // the logic in ReInitSubsystems, since initial state has not been
+      // saved at that time. Short-circuit everything here.
+      fgInitPosition();
     }
-#endif
-
+    
     return true;
 }
 
diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx
index 67882149a..65be585e4 100644
--- a/src/Main/fg_init.cxx
+++ b/src/Main/fg_init.cxx
@@ -1491,6 +1491,8 @@ bool fgInitSubsystems() {
     // End of subsystem initialization.
     ////////////////////////////////////////////////////////////////////
 
+    fgSetBool("/sim/initialized", true);
+
     SG_LOG( SG_GENERAL, SG_INFO, endl);
 
                                 // Save the initial state for future
@@ -1503,25 +1505,32 @@ bool fgInitSubsystems() {
 
 void fgReInitSubsystems()
 {
-    // static const SGPropertyNode *longitude
-    //     = fgGetNode("/sim/presets/longitude-deg");
-    // static const SGPropertyNode *latitude
-    //     = fgGetNode("/sim/presets/latitude-deg");
-    static const SGPropertyNode *altitude
-        = fgGetNode("/sim/presets/altitude-ft");
     static const SGPropertyNode *master_freeze
         = fgGetNode("/sim/freeze/master");
 
-    SG_LOG( SG_GENERAL, SG_INFO,
-            "fgReInitSubsystems(): /position/altitude = "
-            << altitude->getDoubleValue() );
+    SG_LOG( SG_GENERAL, SG_INFO, "fgReInitSubsystems()");
 
+// setup state to begin re-init
     bool freeze = master_freeze->getBoolValue();
     if ( !freeze ) {
         fgSetBool("/sim/freeze/master", true);
     }
+    
+    fgSetBool("/sim/signals/reinit", true);
     fgSetBool("/sim/crashed", false);
 
+// do actual re-init steps
+    globals->get_subsystem("flight")->unbind();
+    
+  // reset control state, before restoring initial state; -set or config files
+  // may specify values for flaps, trim tabs, magnetos, etc
+    globals->get_controls()->reset_all();
+        
+    globals->restoreInitialState();
+
+    // update our position based on current presets
+    fgInitPosition();
+    
     // Force reupdating the positions of the ai 3d models. They are used for
     // initializing ground level for the FDM.
     globals->get_subsystem("ai_model")->reinit();
@@ -1532,11 +1541,11 @@ void fgReInitSubsystems()
     // reload offsets from config defaults
     globals->get_viewmgr()->reinit();
 
-    globals->get_controls()->reset_all();
-
     globals->get_subsystem("time")->reinit();
     globals->get_subsystem("tile-manager")->reinit();
     
+// setup state to end re-init
+    fgSetBool("/sim/signals/reinit", false);
     if ( !freeze ) {
         fgSetBool("/sim/freeze/master", false);
     }
@@ -1546,27 +1555,9 @@ void fgReInitSubsystems()
 
 void doSimulatorReset(void)  // from gui_local.cxx -- TODO merge with fgReInitSubsystems()
 {
-    static SGPropertyNode_ptr master_freeze = fgGetNode("/sim/freeze/master", true);
-
-    bool freeze = master_freeze->getBoolValue();
-    if (!freeze)
-        master_freeze->setBoolValue(true);
-
-    fgSetBool("/sim/signals/reinit", true);
-
-    globals->get_subsystem("flight")->unbind();
-
-    globals->restoreInitialState();
-
-    // update our position based on current presets
-    fgInitPosition();
+    
 
     fgReInitSubsystems();
-
-    fgSetBool("/sim/signals/reinit", false);
-
-    if (!freeze)
-        master_freeze->setBoolValue(false);
 }
 
 ///////////////////////////////////////////////////////////////////////////////