export fix and more ffi stuff