He withdrew $140 from the ATM machine, and got $37,000 instead.
A glitchy bank ATM in South Portland delighted a homeless man on Thursday when it spewed thousands of dollars.
Don't Miss: The hottest Apple Rumors for 2017
According to WGME, a CBS-affiliated TV station, the unsuspecting man tried to withdraw his last remaining money worth $140 at a TD Bank on Maine Mall Road. But the ATM machine apparently gave him more cash, dispensing up to $37,000.
The lucky man could have withdrawn more, even up to $200,000, the maximum amount an ATM bank can hold, if not for the South Portland police who arrived in the scene. They were alerted by a woman who was waiting in line for her turn.
Noticing that the man was spending an unusual amount of time at the ATM, she decided to call the police. The police soon discovered that the man was trying to fill a shopping bag with cash. When asked, the man said that the machine kept giving him money. So he did what any lucky person would do if they were in his place: take the money, and if possible, all of it.
Thankfully, the man decided to return the $37,000. After all, he had no other choice but to oblige.
Police didn't release the man's name because no charges were filed against him. The bank simply blamed the glitch to a coding error in the ATM's system - a small flaw that had the potential to ruin any banking institution.
"Due to a code error, this TD Bank ATM dispensed an incorrect amount of cash to a customer." a TD Bank spokesperson told WGME.