migrate sort pref / fix type sort