BUGFIX: logic error in recomputing balances inside get_history clause.