diff --git a/lib/commands/tag.pm b/lib/commands/tag.pm
index 85c65412f0b141c43e4152a641f1d1ce42b99a0b..9660d6658e5be595119c2ce76d5b7aa95774b572 100644
--- a/lib/commands/tag.pm
+++ b/lib/commands/tag.pm
@@ -17,12 +17,15 @@ sub addTag
 
     my $sth;
 
-    $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag)
-        VALUES (?, ?)');
-	$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
-
-	$sth->execute($id, $tag)
-		or $log->error("Couldn't finish transaction: " . $dbh->errstr);
+    $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag) VALUES (?, ?)');
+    $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
+
+    eval {
+        $sth->execute($id, $tag)
+    };
+	if ($@) {
+        $log->error("Couldn't finish transaction: " . $@);
+    }
 }
 
 1;
diff --git a/lib/sites/parser.pm b/lib/sites/parser.pm
index 6b60f0690a0eb21be42170a37fedaa9469308598..639d86073dca55d45176843fd593f9bbc4039c52 100644
--- a/lib/sites/parser.pm
+++ b/lib/sites/parser.pm
@@ -65,14 +65,20 @@ sub parse {
 	    }
 	    else {
 		    # insertion de la vidéo dans la bdd
-		    my $sth = $dbh->prepare_cached('
-                INSERT INTO playbot (type, url, sender, title, duration)
-                VALUES (?,?,?,?,?)');
-		    $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
-
-		    $sth->execute($content{'site'}, $content{'url'},
-                $content{'author'}, $content{'title'}, $content{'duration'})
-			    or $log->error("Couldn't finish transaction: " . $dbh->errstr);
+            eval {
+                my $sth = $dbh->prepare_cached('
+                    INSERT INTO playbot (type, url, sender, title, duration)
+                    VALUES (?,?,?,?,?)');
+		        $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
+
+		        $sth->execute($content{'site'}, $content{'url'},
+                    $content{'author'}, $content{'title'}, $content{'duration'});
+
+                $dbh->commit;
+            };
+            if ($@) {
+			    $log->error("Couldn't finish transaction: " . $@);
+            }
 	    }
 
 	    # sélection de l'id de la vidéo insérée