[BUGFIX] logic error in ldap_sort