diff --git a/PlayBot/utils/db/get.pm b/PlayBot/utils/db/get.pm
index e73c2547fce641f84c83111d342ed96bbed03f53..a0ceb9ddfdcc43ebfbc574d8943dc885730a0d26 100644
--- a/PlayBot/utils/db/get.pm
+++ b/PlayBot/utils/db/get.pm
@@ -169,8 +169,8 @@ sub _prepare_request {
         if ($query->is_global) {
             $req = 'select p.id, p.sender, p.title, p.url, p.duration';
             $req .= ' from playbot p';
-            $req .= ' where '.$words_sql if ($words_sql);
-            $req .= ' and p.playlist is false';
+            $req .= ' where '.$words_sql.' and' if ($words_sql);
+            $req .= ' p.playlist is false';
             $req .= ' group by p.id order by rand()';
 
             @args = (@words_param);