fixed potential transaction scope bugs