How to set the value of a field "reference to a term" with the use of entity_metadata_wrapper? In a content type with a have taxonomy field "reference to a term" which I want to connect to a webform submission.

I have the following code in rules: 

$brancheid = $submissions[$sid]-&gt;data[1][0];
$oplossingsid = $submissions[$sid]-&gt;data[2][0];
$nodeid = $submissions[$sid]-&gt;data[3][0];

$node = node_load($nodeid);
$node_wrapper = entity_metadata_wrapper('node', $node);
$node_wrapper-&gt;title-&gt;set('done');   // this is working
$node_wrapper-&gt;save();
$node_wrapper-&gt;field_sector-&gt;set($brancheid);
$node_wrapper-&gt;field_dienst-&gt;set($oplossingsid);
$node_wrapper-&gt;save();


After submission of the webform the title is saved. But field_sector and field_dienst (taxonomy reference to a term types) and are not saved. I tried several combinations but do not get it. 

What should I do?
Strange. This is not working:

$node_wrapper-&gt;field_sector-&gt;set($brancheid);
$node_wrapper-&gt;field_dienst-&gt;set($oplossingsid);


But this is working:

$node_wrapper-&gt;field_sector = $brancheid;
$node_wrapper-&gt;field_dienst = $oplossingsid;