ATM

Figure out how the program works.
During testing, the log was found to contain the following:
.....
Deposit 100, account balance 1100
Deposit 100, account balance 1200
Spend 1000, account balance 100
Insufficient money
.....
There's a bug: Money is lost when debiting an account.
Find and fix the bug.