Fix potential race condition in FFI callback handler.
Bump to 1.0.4.