diff --git a/helios/models.py b/helios/models.py
index 551c4ae313292ad6b4e12d40bf545be9cec8e27e..d8faa777478b1b98c9bbda823883dabf61665e0a 100644
--- a/helios/models.py
+++ b/helios/models.py
@@ -183,7 +183,7 @@ class Election(HeliosModel):
     if not self.use_voter_aliases:
       return None
     
-    return utils.one_val_raw_sql("select max(cast(substring(alias, 2) as integer)) from " + Voter._meta.db_table + " where election_id = %s", [self.id]) or 0
+    return utils.one_val_raw_sql("select max(cast(substr(alias, 2) as integer)) from " + Voter._meta.db_table + " where election_id = %s", [self.id]) or 0
 
   @property
   def encrypted_tally_hash(self):