praveen|fixing total balances logic