diff --git a/modules/Bio/EnsEMBL/Hive/Extensions.pm b/modules/Bio/EnsEMBL/Hive/Extensions.pm
index e11bf3713dda133cfa209e5dc3acf6fe0a3c6247..2f9ae0af21352fe097288ed45c2238622ba6cff2 100755
--- a/modules/Bio/EnsEMBL/Hive/Extensions.pm
+++ b/modules/Bio/EnsEMBL/Hive/Extensions.pm
@@ -169,5 +169,13 @@ sub Bio::EnsEMBL::Pipeline::RunnableDB::global_cleanup
   return 1;
 }
 
+sub Bio::EnsEMBL::Pipeline::RunnableDB::branch_code
+{
+  my $self = shift;
+  $self->{'_branch_code'} = shift if(@_);
+  $self->{'_branch_code'}=1 unless($self->{'_batch_size'});
+  return $self->{'_branch_code'};
+}
+
 1;
 
diff --git a/modules/Bio/EnsEMBL/Hive/Worker.pm b/modules/Bio/EnsEMBL/Hive/Worker.pm
index 5f44949f6340249cee9b3e71da3c764897c3abce..afa508c981a3775e73d289da5110f560c5430fb0 100755
--- a/modules/Bio/EnsEMBL/Hive/Worker.pm
+++ b/modules/Bio/EnsEMBL/Hive/Worker.pm
@@ -357,12 +357,12 @@ sub run_module_with_job
   $runObj->run;
 
   $job->status('WRITE_OUTPUT');
-  my $branch_code = $runObj->write_output;
+  $runObj->write_output;
 
   #runnableDB is allowed to alter its input_id on output
   #This modified input_id is passed as input to the next jobs in the graph
   $job->input_id($runObj->input_id);
-  $job->branch_code($branch_code);
+  $job->branch_code($runObj->branch_code);
 
   return 1;
 }