Bug fix in get_instance_ids