North Dakota produced record levels of both oil and gas in August after registering the largest number of wells on record, state officials said Friday.

North Dakota, the second-largest U.S. oil producing state behind Texas, produced 40 million barrels of oil in August. That is “an all-time high,” and 1.7 percent greater than July, said Lynn Helms, North Dakota’s director of mineral resources.

Gas production in August jumped 1.8 percent to reach a record 75.6 million cubic feet.

“There is a lot of good news to talk about,” Helms said.

The number of active oil wells in the state rose to a record 15,103 in August. “We never before produced from 15,000 wells or produced 40 million barrels of oil,” Helms said.

While production numbers impressed, other problems lurked in the wings.

North Dakota continued to produce more gas than it could process, which forced some producers to burn off excess gas or to restrict their overall oil and gas production in an attempt to comply with new state laws limiting how much gas can be burned off in a process known as “flaring.”

Separately, labor shortages continued to plague firms trying to set up new wells and gas processing plants in the state.

The new Little Missouri Four gas plant near Watford City, N.D., was supposed to come online next month, but the opening has been delayed. The $150 million plant was expected to help speed up the processing of gas so that excess natural gas wouldn’t have to be burned off.

“It’s a workforce issue,” Helms said. “They could only get about 40 percent of the pipe fitters and welders that they needed. So they will be six months behind.”

Helms said North Dakota’s rig count rose from 61 in August to 65 in September to 67 today. State officials said they would like to see that number jump to 70 by the end of the year. Still, such numbers are way down from the high of 218 reached in May 2012.