A couple of dogs in Central Pennsylvania started a fire in their home this week while attempting to nab a box of cupcakes the owner had left on the counter. Fortunately, the owner’s landlord dropped by the apartment to let the dogs outside and noticed the fire, the Associated Press reported. Police determined that in their attempt to reach the snacks, the dogs turned the knobs on the stove.

Counter-surfing might not always cause such a dramatic effect, but it is a bothersome behavior that shouldn’t be tolerated by dog owners. It’s a self-rewarding behavior, meaning, as this article explains, that if the dog succeeds, he gets a reward (like a cupcake), which only reinforces the behavior. This makes it difficult to train against. But it’s not impossible.

Kathy Santo, a dog trainer and columnist for AKC Family Dog, recommends the following when dealing with a counter-surfing dog:

Remove the opportunity

Make sure nothing (not even crumbs) is on the counter. “I call this the Empty Bird Feeder Effect,” Santo says. “After you stop filling a bird feeder, the birds eventually stop coming around.” If you must keep food on the counter (a pie to cool, for example, or a spread for a party), keep the dog out of the kitchen using a baby gate, or put in him a crate or behind a shut door.

Reward him for resisting

Teach your dog to “go to his place.” If you see him in the kitchen sniffing around, instead of yelling at him or punishing him, tell him to go to his place and reward him for obeying. Soon he’ll realize that the likelihood of his getting a treat is higher when he listens to you than when he sneaks a snack behind your back.

Still, even if your dog is trained, remember to be vigilant about keeping those counters and coffee tables clear. “There are some dogs who, no matter how well trained they are, will have a momentary lapse in judgment if you leave the room with a temptation on the counter,” Santo says.

The Five Commands Every Dog Should Know

Do you want a well behaved dog but don’t know where to begin? The Basic five commands e-book is a great place to start and will give your dog a strong foundation for future training.