Police in Miami Beach say a homeless man broke into a car, stole a credit card and then tried to use it to buy a beer — from the bartender the card belonged to.

The case was cracked when 53-year-old David Weber handed the card to the bartender who took his order Monday night. The Miami Herald reports the bartender noticed he had just been handed his own credit card.

The bartender called Miami Beach police. Weber was charged with credit card fraud and theft. He remained in the Miami-Dade County Jail early Wednesday.

Police say Weber told them he found the credit card on the ground.