fixup botched rebase, 64bit fixes
don't forget to add native code in the new API too