Replaced weakrefs with ffi.gc