Fix preferences window as proper dialog, and correct loading of settings in main form.