Fixed memory allocation and copying in setter functions in btree