diff --git a/lib/utils/db/query.pm b/lib/utils/db/query.pm
index 633d7a892bddfb72e0f3256cafe53c19fec255c0..6361ef47bc907c33e303d1e688b277d30e171968 100644
--- a/lib/utils/db/query.pm
+++ b/lib/utils/db/query.pm
@@ -73,11 +73,11 @@ sub _get_next {
     # we come here only if there is no more data to fetch
 
     # we take care of the db
-    $self->_sth->{$chan} = undef;
+    delete $self->_sth->{$chan};
     $self->_get_dbh($chan)->commit();
 
     # we remove the query
-    $self->_queries->{$chan} = undef;
+    delete $self->_queries->{$chan};
 
     return undef;
 }