Bugfixes for instance id lookup