temp sort workaround