add transaction and fix many things