Added extra sanity checks around transactions.

Trying to figure out #34.