Surfer Mick Fanning managed to fight off a shark attack during a surfing competition in South Africa on Sunday.
A video that went viral shows the attempted attack in the opening minutes of the competition’s final heat. The shark snapped Fanning’s board off of his ankle leash in the process. In an interview, Fanning—visibly shaken—says he was kicking and screaming as the shark kept coming at him and he punched it in the back.
Fanning reacted correctly when the shark approached him, according to George H. Burgess, the director of the Florida Program for Shark Research at the Florida Museum of Natural History, who spoke to TIME about how to survive a shark attack.
“He did the right thing,” Burgess told TIME. “He tried to get something between the shark and himself and he reacted appropriately which is to be aggressive.”
Burgess says that when a shark approaches, bopping it on its nose can scare it away. “Hitting the snout of the shark with a hard object like your fist or an inanimate object will startle the shark,” says Burgess. “The shark will most often veer off. During that veer off, take full advantage of that time to get out of the water. The shark will likely come back if it’s genuinely interested and you might get away with a second bop, but maybe not.”
If the shark has you in its mouth—which thankfully didn’t happen to Fanning—Burgess recommends (if you can) poking the shark hard in the eyes or in the gills. “Those areas are very sensitive,” says Burgess.
The Florida Museum of Natural History says beach-goers should stay in groups because sharks are more likely to attack a solitary individual, and warns swimmers not to wander too far away from shore.
Staying out of the water during darkness or twilight hours is recommended since that’s when sharks are most active, and people should not enter the water if they are bleeding or menstruating. Don’t wear shiny jewelry because it can look like fish scales, the museum warns.
The museum also says people should refrain from splashing and should not let pets in the water since they have lots of spontaneous movement.