Fix discount logic for totalBalance