Bugfixes for lookup