I assume that invoking callForeign that the apiStack should be restored to it's original value, rather than reset to NULL.