Fix #136: roll back transactions on exception (redux)

Replaces #187 (rebased / conflicts removed).