opt_out cannot be set to 1 via logichook

Hi all.

I have a simple bit of code which is working fine when opting out email addresses, but not opting it. I was wondering if there was any logic forcing someone to do this manually in CRM. The if block is as folows:

if ($child_lead->occasional_updates_c == 'Yes')
						{
							foreach($child_lead->emailAddress->addresses as $email)
							{
								print "<pre>";
								print_r($email);
								print "</pre>";
								//Setting up the bean creation in a tidy way
								$module = 'EmailAddresses';
								$record_id = $email['email_address_id'];
								$email = BeanFactory::getBean($module, $record_id, array('disable_row_level_security' => true));
								$email->opt_out = 0;
								$email->save();
							}
						} elseif ($child_lead->occasional_updates_c == 'No')
						{
							foreach($child_lead->emailAddress->addresses as $email)
							{
								//Setting up the bean creation in a tidy way
								$module = 'EmailAddresses';
								$record_id = $email['email_address_id'];
								$email = BeanFactory::getBean($module, $record_id, array('disable_row_level_security' => true));
								$email->opt_out = 1;
								$email->save();
							}
						}

As mentioned the $email->opt_out = 1; works perfectly fine but the other does not.

Thanks!