use a RawVector instead of as.raw(SEXP)