Zoho Flow not handling Boolean properly

Zoho Flow not handling Boolean properly

Hi, I have a checkbox in one system that I'm trying to sync with a checkbox in Zoho CRM. The value from the source system comes in as blank (unticked) or 1 (ticked). I've written the following custom function to convert the output to either boolean false or true. The output from the function looks correct, however in the next step where I map the function output as an input into the Zoho CRM contact update, it returns the following error:
 
Zoho CRM says "Invalid input for Marketing_Email_Allowed. The expected input type is boolean."

As far as I can tell it is already a boolean field with the correct values in it. Can any one help with why CRM is rejecting it?

Custom Function:

bool SetEmailOptIn(string WebHookEmailOptIn)
{
if(WebHookEmailOptIn == "")
{
return false;
}
else if(WebHookEmailOptIn == "0")
{
return false;
}
else
{
return true;
}
}

Output from Actions:

From Web Hook: "amp__isOptedInToMarketingEmails": 1,
Input into Custom Function: "WebHookEmailOptIn": 1
Output from Custom Function: "setEmailOptIn_3": true
Input into CRM contact update: "Marketing Email Allowed": true,
Output from CRM contact update: Zoho CRM says "Invalid input for Marketing_Email_Allowed. The expected input type is boolean."