diff --git a/lib/commands/get.pm b/lib/commands/get.pm
index 1237938e07e588cd667325c8fdbf8c7788a33e73..0284c3ea4ad14d167fb65165adc8ac4f12e69bc6 100644
--- a/lib/commands/get.pm
+++ b/lib/commands/get.pm
@@ -13,12 +13,12 @@ our $irc;
 sub exec {
 	my ($kernel, $user, $chan, $msg) = @_;
 
-    my @tags = ($msg =~ /#?([a-zA-Z0-9_-]+)/g);
-    my $content;
-
     # if we are in a query or arg -all, we search in all the channels
     my $all = 0;
-    $all = 1 if ($chan->[0] !~ /^#/ || $chan->[0] =~ s/-all//);
+    $all = 1 if ($chan->[0] !~ /^#/ || $msg =~ s/-all//);
+
+    my @tags = ($msg =~ /#?([a-zA-Z0-9_-]+)/g);
+    my $content;
 
     if (@tags) {
         my $params = join ', ' => ('?') x @tags;