diff --git a/ledger_pyreport/accounting.py b/ledger_pyreport/accounting.py
index 4aa335a..e02364c 100644
--- a/ledger_pyreport/accounting.py
+++ b/ledger_pyreport/accounting.py
@@ -113,7 +113,7 @@ def account_to_cash(account, currency):
balancing_posting.transaction.postings.remove(balancing_posting)
if amount_remaining != 0:
- if account.is_asset:
+ if posting.account.is_asset:
# Cash - charge any unbalanced remainder to Other Income
posting.transaction.postings.append(Posting(posting.transaction, account.ledger.get_account(config['cash_other_income']), Amount(-amount_remaining, currency)))
else:
diff --git a/ledger_pyreport/jinja2/transactions.html b/ledger_pyreport/jinja2/transactions.html
index 01a991c..92126b2 100644
--- a/ledger_pyreport/jinja2/transactions.html
+++ b/ledger_pyreport/jinja2/transactions.html
@@ -22,7 +22,7 @@
{% block links %}
{{ super() }}
- Show commodity detail
+ {% if account %}Show commodity detail{% endif %}
{% endblock %}
{% block report %}