fix duplicate primary key issue, cleanup db serialization, and cleanup meta transaction string alloc/dalloc