diff --git a/newbrt/brt.c b/newbrt/brt.c
index 2909cde85050d39f74826176f466a111921f979b..9c7265cc96435500102a6dc6c413c1c3888dc5b4 100644
--- a/newbrt/brt.c
+++ b/newbrt/brt.c
@@ -798,23 +798,24 @@ static int brtnode_maybe_push_down(BRT t, BRTNODE node, int *did_split, BRTNODE
     return 0;
 }
 
-//#define INSERT_ALL_AT_ONCE
+#define INSERT_ALL_AT_ONCE
 
 static int brt_leaf_insert (BRT t, BRTNODE node, DBT *k, DBT *v,
 			    int *did_split, BRTNODE *nodea, BRTNODE *nodeb, DBT *splitk,
 			    int debug,
 			    DB *db) {
-    DBT v2;
 #ifdef INSERT_ALL_AT_ONCE
     int replaced_v_size;
-    enum pma_errors pma_status = pma_insert_or_replace(node->u.l.buffer, k, init_dbt(&v2), db, &replaced_v_size);
+    enum pma_errors pma_status = pma_insert_or_replace(node->u.l.buffer, k, v, db, &replaced_v_size);
     assert(pma_status==BRT_OK);
+    //printf("replaced_v_size=%d\n", replaced_v_size);
     if (replaced_v_size>=0) {
 	node->u.l.n_bytes_in_buffer += v->size - replaced_v_size;
     } else {
 	node->u.l.n_bytes_in_buffer += k->size + v->size + KEY_VALUE_OVERHEAD;
     }
 #else
+    DBT v2;
     enum pma_errors pma_status = pma_lookup(node->u.l.buffer, k, init_dbt(&v2), db);
     if (pma_status==BRT_OK) {
 	pma_status = pma_delete(node->u.l.buffer, k, db);
diff --git a/newbrt/pma.c b/newbrt/pma.c
index 3868be4450dec3b5768f51ce64561899605f58e1..02aeef0de56607673e3c6122c4578b95aa92187f 100644
--- a/newbrt/pma.c
+++ b/newbrt/pma.c
@@ -578,6 +578,7 @@ int pma_delete (PMA pma, DBT *k, DB *db) {
 int pma_insert_or_replace (PMA pma, DBT *k, DBT *v, DB *db,
 			   int *replaced_v_size /* If it is a replacement, set to the size of the old value, otherwise set to -1. */
 			   ) {
+    //printf("%s:%d v->size=%d\n", __FILE__, __LINE__, v->size);
     int idx = pmainternal_find(pma, k, db);
     struct kv_pair *pair;
     if (idx < pma_index_limit(pma) && (pair=pma->pairs[idx])) {
@@ -592,6 +593,7 @@ int pma_insert_or_replace (PMA pma, DBT *k, DBT *v, DB *db,
         idx = pmainternal_make_space_at (pma, idx); /* returns the new idx. */
     }
     assert(!pma->pairs[idx]);
+    //printf("%s:%d v->size=%d\n", __FILE__, __LINE__, v->size);
     pma->pairs[idx] = kv_pair_malloc(k->data, k->size, v->data, v->size);
     assert(pma->pairs[idx]);
     pma->n_pairs_present++;