Added proper support for foreign wrappers. Fixes issue #4#4