balance calculations fix