fix a bug in transaction handling