Purging transactions from the wallet on rescan and fix a bug with address balances