Fixes for string marshaling in FFI