Add basic Tx tests, plus some bug fixes discovered via those tests (must be good ones)