Fixed cmdline mode preferences, and moved the upgrade code to onLoad, since prefs are used there.
Merge origin/master