Bug fix in pref_window