Initialize command and flag fields of transactions

This commit adds initialization codes for fields which were left
uninitialized before, potentially leading to segfaults.