Fix some big number primitives
Fixes issue #177
Some RTS functions to help with allocation in foreign functions