Check that affiliate_id is not false and then properly set the property. Fixes #327