fix sort compat for py3