made ldsearch (and convertBase) more elegant (and less buggy)