avoid cryptic errors by checking for transaction

Without checking for this.transaction, a simple "access denied" error turns into the cryptic "cannot call commit on undefined" error.