fix write_string incompatability in newer FFI versions