Fixed crash on loading preferences.