You should use 'copyasvalueref()' here (MCurlresult is an MCVariable which means it has a valueref to copy).