FFI: check the cleanup flag