diff --git a/modules/t/altAlleleGroup.t b/modules/t/altAlleleGroup.t
index b8be460a9e1baadd0630cac37f1e901ab01ce0e3..f7747e1d7dd79a9b7dc7e62011b609785157aa96 100644
--- a/modules/t/altAlleleGroup.t
+++ b/modules/t/altAlleleGroup.t
@@ -98,8 +98,8 @@ my $gene = $aag->get_representative_Gene;
 is($gene->stable_id, 'ENSG00000131044',"Ensure both correct instantiation of Gene and ID thereof");
 
 #Checking we can filter the members list by a gene object and an ID
-is_deeply($aag->get_all_Gene_ids(undef, [18259]), [18256, 18257,18258], 'Filtering out a Gene by ID');
-is_deeply($aag->get_all_Gene_ids(undef, [$ga->fetch_by_dbID(18259)]), [18256, 18257,18258], 'Filtering out a Gene by object');
+is_deeply($aag->get_all_Gene_ids(undef, [18259]), [18256, 18257,18258,18259], 'Filtering out a Gene by ID');
+is_deeply($aag->get_all_Gene_ids(undef, [$ga->fetch_by_dbID(18259)]), [18256, 18257,18258,18259], 'Filtering out a Gene by object');
 
 my $gene_list = $aag->get_all_Genes;
 $gene = $gene_list->[0];
diff --git a/modules/t/dbEntries.t b/modules/t/dbEntries.t
index dde4c1fa8c43a01ca6846cd0341b39be5d761454..9a950a5a95f04376cc4afdd2cc6b3197a358fb22 100644
--- a/modules/t/dbEntries.t
+++ b/modules/t/dbEntries.t
@@ -199,7 +199,8 @@ $xref = Bio::EnsEMBL::DBEntry->new
    );
 
 use Config;
-my $stored_xref_id = 1000002;
+my $stored_xref_id = 
+  $db->dbc->sql_helper()->execute_single_result(-SQL => 'select IFNULL(max(xref_id), 0) from xref', -NO_ERROR => 1);
 if($Config{useithreads}) {
   note 'Using threaded tests';
   require threads;
diff --git a/modules/t/registry.t b/modules/t/registry.t
index 86fd82ebef553c8093002c94ba12a2209f29ba75..e5a8b28a782ed3dacc725cb6ceb2f35e62c87818 100644
--- a/modules/t/registry.t
+++ b/modules/t/registry.t
@@ -103,4 +103,4 @@ my @species = $reg->get_all_species();
 ok(scalar(@species) == 1, "get_all_species");
 ok(scalar(@{ $reg->get_all_species('cahoona') }) == 0, "get_all_species with bogus data.");
 
-done_testing();
\ No newline at end of file
+done_testing();