A Chinese bank programmer was jailed after he withdrew over 7 million yuan (around $1,000,000) by using an ATM loophole.

In 2016, Qin Qisheng, a 43-year-old man who worked at Huaxia Bank’s technology development center in Beijing, discovered a flaw in the bank’s main operating system, the South China Morning Post reported. Due to the loophole, cash withdrawals made around 12 a.m. weren’t recorded, enabling Qisheng to play around with the bank’s system and take out cash without activating an alert.

From 2016 to 2018, Qisheng withdrew between 5,000 yuan and 20,000 yuan ($740 to $2,965) from a mock account the bank used for testing. By the beginning of last year, Qisheng had collected over $1,000,000, added it to his personal bank account, and didn’t tell his supervisors about the loophole.

Last year, a subsidiary branch in Cangzhou, China, discovered the strange activity in the dummy account and notified authorities. Once Qisheng was caught, the bank surprisingly didn’t want to keep pressing charges: It accepted that Qisheng was trying to investigate the ATM flaw and they requested police to drop the case if he gave back the money.

Even though Qisheng returned the money, it still wasn’t enough to make up for his actions: He was found guilty of theft, sentenced to 10 and a half years in jail, and fined 11,000 yuan ($16,000). Huaxia Bank also fixed the ATM loophole to prevent future internal theft incidents.