use wrapped compact for a-not-b
diff --git a/src/theta_sketch_c_adapter.cpp b/src/theta_sketch_c_adapter.cpp
index 8f46280..dd635e9 100644
--- a/src/theta_sketch_c_adapter.cpp
+++ b/src/theta_sketch_c_adapter.cpp
@@ -228,12 +228,12 @@
   pg_unreachable();
 }
 
-void* theta_a_not_b(const void* sketchptr1, const void* sketchptr2) {
+void* theta_a_not_b(const void* buffer1, unsigned length1, const void* buffer2, unsigned length2) {
   try {
     theta_a_not_b_pg a_not_b;
     return new (palloc(sizeof(compact_theta_sketch_pg))) compact_theta_sketch_pg(a_not_b.compute(
-      *static_cast<const theta_sketch_pg*>(sketchptr1),
-      *static_cast<const theta_sketch_pg*>(sketchptr2)
+      wrapped_compact_theta_sketch_pg::wrap(buffer1, length1),
+      wrapped_compact_theta_sketch_pg::wrap(buffer2, length2)
     ));
   } catch (std::exception& e) {
     pg_error(e.what());
diff --git a/src/theta_sketch_c_adapter.h b/src/theta_sketch_c_adapter.h
index 4c716c1..5d6eef1 100644
--- a/src/theta_sketch_c_adapter.h
+++ b/src/theta_sketch_c_adapter.h
@@ -52,7 +52,7 @@
 void theta_intersection_update(void* interptr, const void* buffer, unsigned length);
 void* theta_intersection_get_result(const void* interptr);
 
-void* theta_a_not_b(const void* sketchptr1, const void* sketchptr2);
+void* theta_a_not_b(const void* buffer1, unsigned length1, const void* buffer2, unsigned length2);
 
 #ifdef __cplusplus
 }
diff --git a/src/theta_sketch_pg_functions.c b/src/theta_sketch_pg_functions.c
index c6678f4..27ca259 100644
--- a/src/theta_sketch_pg_functions.c
+++ b/src/theta_sketch_pg_functions.c
@@ -383,8 +383,6 @@
 Datum pg_theta_sketch_a_not_b(PG_FUNCTION_ARGS) {
   const bytea* bytes_in1;
   const bytea* bytes_in2;
-  void* sketchptr1;
-  void* sketchptr2;
   void* sketchptr;
   struct ptr_with_size bytes_out;
 
@@ -393,12 +391,8 @@
   }
 
   bytes_in1 = PG_GETARG_BYTEA_P(0);
-  sketchptr1 = theta_sketch_deserialize(VARDATA(bytes_in1), VARSIZE(bytes_in1) - VARHDRSZ);
   bytes_in2 = PG_GETARG_BYTEA_P(1);
-  sketchptr2 = theta_sketch_deserialize(VARDATA(bytes_in2), VARSIZE(bytes_in2) - VARHDRSZ);
-  sketchptr = theta_a_not_b(sketchptr1, sketchptr2);
-  theta_sketch_delete(sketchptr1);
-  theta_sketch_delete(sketchptr2);
+  sketchptr = theta_a_not_b(VARDATA(bytes_in1), VARSIZE(bytes_in1) - VARHDRSZ, VARDATA(bytes_in2), VARSIZE(bytes_in2) - VARHDRSZ);
   bytes_out = theta_sketch_serialize(sketchptr, VARHDRSZ);
   theta_sketch_delete(sketchptr);
   SET_VARSIZE(bytes_out.ptr, bytes_out.size);