But what if someone bids and then spends the money, auction system would glitch and stop working
The auction system would take their money when they bid, and if someone out-bids them, they'll get their money back. If they win the auction, the system will keep the money and the winner will receive the item.