Fixed a bug in substring evaluation that Karl discovered in the LDAP package; we should really eliminate these duplications in the future.