Fixed an more or less serious issue when doing lookups.