fix transaction error logic