message: Dumb copy&paste error fixed, sanity check added.
diff: @@ -1277,8 +1277,7 @@ CAmount CWallet::GetZerocoinBalance() const
  }
  LogPrint("zero","Total value of coins %d\n",nTotal);
  -
  -
  + if (nTotal < 0 ) nTotal = 0; // Sanity never hurts
  return nTotal;
  }
  @@ -3438,7 +3437,7 @@ void CWallet::AutoZeromint()
  }
  // Percentage of zPIV we already have
  - double dPercentage = 100 * (double)nZerocoinBalance / (double)nBalance;
  + double dPercentage = 100 * (double)nZerocoinBalance / (double)(nZerocoinBalance + nBalance);
  // Check if minting is actually needed
  if(dPercentage >= nZeromintPercentage){
  @@ -3448,7 +3447,7 @@ void CWallet::AutoZeromint()
  }
  // zPIV amount needed for the target percentage
  - nToMintAmount = (nBalance * nZeromintPercentage / 100);
  + nToMintAmount = ((nZerocoinBalance + nBalance) * nZeromintPercentage / 100);
  // zPIV amount missing from target (must be minted)
  nToMintAmount = (nToMintAmount - nZerocoinBalance) / COIN;
  @@ -3490,7 +3489,7 @@ void CWallet::AutoZeromint()
  }
  nZerocoinBalance = GetZerocoinBalance();
  nBalance = GetUnlockedCoins();
  - dPercentage = 100 * (double)nZerocoinBalance / (double)nBalance;
  + dPercentage = 100 * (double)nZerocoinBalance / (double)(nZerocoinBalance + nBalance);
  LogPrintf("CWallet::AutoZeromint(): successfully minted %ld zPIV. Current percentage of zPIV: %lf%%\n", nMintAmount, dPercentage);
  }
  else {
  