xa transaction recovery and some bug fixes related to txn/locking