rewrite read using a new FFI strategy