Fix foreign function call