It happened at the Miss Universe pageant and the Oscars, so why not the science fair?

A potential tabulating error caused the wrong name to be announced as the grand champion of Thursday’s 67th annual North Museum Science and Engineering Fair at Millersville University.

Gaurav Mittal, a Manheim Township High School junior and the 2017 grand champion, was initially announced the night’s big winner. But it was Elizabethtown Area High School senior Logan Vogelsong, a first-time science fair participant, who ultimately came away with the award.

The two students were asked to swap honors once most of the students left the awards ceremony to disassemble their projects.

“I didn’t quite think I would win it at all,” Vogelsong, who, along with Mittal, will head to Phoenix, Arizona, to participate in the Intel International Science and Engineering Fair in May, said after the ceremony.

More than 325 of Lancaster County’s brightest students presented at the fair.

Among the big winners were Mittal, this year’s senior champion; Lancaster Country Day School sophomore Arielle Breuninger, senior reserve champion; Manheim Township Middle School eighth-grader Pritesh Tanna, junior champion; and The New School of Lancaster eighth-grader Xyla Carlson, junior reserve champion.

Emerson Long, a Landisville Middle School seventh-grader, earned the LNP/Lancaster County STEM Alliance Innovation award.

For his project, “Using Learning Algorithms to Model Proteins,” Vogelsong used lengthy streams of code to model proteins, of which he said there are about 50,000 in the human body.

Such a concept could lead to the creation of better pharmaceutical drugs and potentially “bring the eradication of all disease,” Vogelsong said.

Vogelsong said he taught himself how to code using the program Python. He’s spent every night coding for the past week, sometimes working into the next morning.

His mother, Kathy Vogelsong, said he would pop into his parents’ room at 1 a.m. with his laptop to show them something new he discovered.

“I’m just so happy for him,” Kathy said. “All of his hard work paid off.”

The Vogelsongs almost didn’t make it to the science fair, she added. Her car broke down on the way, and her husband had to leave work early to pick them up.

Who knew that wouldn’t be the weirdest thing that happened Thursday?

When Logan was told he, not Mittal, was the grand champion, it took a little bit to sink in.

“Whoa, that means I’m grand champion?” he said, as his family and friends erupted in applause.

Logan said he plans to major in chemical engineering in college and perhaps expand upon his project if he lands a job in pharmaceuticals.