bugfix with transactions