check balance logic fixed