minor fix in balance calclation