diff --git a/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm b/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
index 29443e5cf4ff6022a21254671d35d02c1d371371..608f958016ef66d41b6378e9f0949c2f4bb3b88d 100644
--- a/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
+++ b/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
@@ -450,18 +450,23 @@ sub claim_jobs_for_worker {
   my $claim = $ug->to_string( $uuid );
   #print("claiming jobs for hive_id=", $worker->hive_id, " with uuid $claim\n");
 
-  my $sql = "UPDATE analysis_job SET job_claim='$claim'".
-            " , hive_id='". $worker->hive_id ."'".
-            " , status='CLAIMED'".
-            " WHERE job_claim='' and status='READY'".
-            " AND analysis_id='" .$worker->analysis->dbID. "'".
-            " LIMIT " . $worker->batch_size;
-
-  #print("$sql\n");            
-  my $sth = $self->prepare($sql);
-  $sth->execute();
-  $sth->finish;
-
+  my $sql_base = "UPDATE analysis_job SET job_claim='$claim'".
+                 " , hive_id='". $worker->hive_id ."'".
+                 " , status='CLAIMED'".
+                 " WHERE job_claim='' and status='READY'". 
+                 " AND analysis_id='" .$worker->analysis->dbID. "'";
+
+  my $sql_virgin = $sql_base .  
+                   " AND retry_count=0".
+                   " LIMIT " . $worker->batch_size;
+
+  my $sql_any = $sql_base .  
+                " LIMIT " . $worker->batch_size;
+  
+  my $claim_count = $self->dbc->do($sql_virgin);
+  if($claim_count == 0) {
+    $claim_count = $self->dbc->do($sql_any);
+  }
   return $claim;
 }