North Dakota posted a solid March for oil production, while hitting a new record for natural gas output, state data released Wednesday show.

But surging production over the past year continues to leave North Dakota well short of its goals to reduce the flaring of natural gas. Gas that can’t be captured is burned off, a waste of resources and an environmental issue.

North Dakota, the nation’s second-largest oil producer after Texas, pumped out 1.39 million barrels of oil per day in March, up 4% over the previous month, according to the North Dakota Department of Mineral Resources. The state’s record monthly output was 1.4 million barrels per day in January.

Natural gas production in North Dakota in March was up 6.5% to 2.8 million MCF per day. An MCF is 1,000 cubic feet of gas.

For both oil and gas, “there was a pretty good recovery in production volumes,” Lynn Helms, director of the mineral resources department, said in a media conference call Wednesday. In February, North Dakota’s oil production fell 5% — the largest monthly decline in more than two years — due to extremely cold weather.

The harsh winter continued to affect production into early March, but then the weather eased. “I fully anticipate when we get to April we are going to get back to setting records,” Helms said of oil production.

U.S. shale-oil fields are generally expected to post record production levels this year. Oil prices have been particularly volatile of late, with West Texas Intermediate — the benchmark U.S. crude price — trading Wednesday at just over $62 per barrel. But prices are generally forecast to be higher for the year, Helms said.

North Dakota’s oil-rig count, which indicates well-drilling activity, currently stands at 65, up from 63 in April, but one rig shy of March’s mark. A year ago in May, the rig count was 60. “The rig count has been very solid — in the mid 60s — and we expect that to continue,” Helms said.

On the negative side, North Dakota’s ability to capture and process natural gas hasn’t kept up with rising gas production. In March, 80% of the state’s gas output was captured, while the rest was flared. A year earlier, 88% of gas production was captured and 12% flared.

Flaring releases carbon dioxide and methane — the two main greenhouse gases — into the atmosphere.

Gas capture dropped into the low 80% levels in the second half of 2018, hitting a recent low of 79% in January. March was the second-worst performance for gas capture over the year.

To make matters worse, North Dakota’s statewide gas-capture goal rose in November from 85% to 88%.

“Gas capture and flaring is a struggle,” Helms said. And the situation isn’t likely to improve appreciably until the fourth quarter when more gas-processing infrastructure is expected to come online, he said.