diff --git a/bitaddress-vanity.html b/bitaddress-vanity.html
index 369b896..c973fac 100644
--- a/bitaddress-vanity.html
+++ b/bitaddress-vanity.html
@@ -9116,7 +9116,7 @@ ninja.wallets.brainwallet = {
i = i + 1;
bytes = Crypto.SHA256(key + i, { asBytes: true });
btcKey = new Bitcoin.ECKey(bytes);
- } while (btcKey.getBitcoinAddress().substring(0,vanitylength) != pattern);
+ } while (btcKey.getBitcoinAddress().substring(0,vanitylength) != vanitypattern);
var bitcoinAddress = btcKey.getBitcoinAddress();
var privWif = btcKey.getBitcoinWalletImportFormat();
document.getElementById("brainbtcaddress").innerHTML = bitcoinAddress;