diff --git a/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
index 9460011006c44c4100f3e6919311f34679a1b8c7..8fd990a1e7567ff38d3d764beb6b6aaf3e07283b 100644
--- a/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
@@ -237,7 +237,7 @@ sub store {
 	my ($tst) = $sth->fetchrow_array;
 
 
-	if (! defined $sth) {
+	if (! defined $tst) {
 	# line is already in Xref table. Need to add to objectXref
 	    $sth = $self->prepare( "
              INSERT INTO objectXref