Fixed bugs with lookup command.