fix a tx bug and add some logging