fixed bugs in transactions