Fixing a bug in transactions