ST. PAUL (AP) — A new report says Minnesota farm incomes marginally improved in 2016, but more than 30 percent of the state's farmers were in red last year amid the third straight year of declining commodity prices.

Crop producers could tread water financially, thanks to record yields. But the median crop producer still didn't earn enough to meet family needs. Livestock producers generally fared worse as milk, pork and beef prices hit new lows.

Those are some of the key findings in the annual study released Tuesday by University of Minnesota Extension and the Minnesota State Colleges and Universities system.

Across all types of Minnesota farms, the median net farm income was $35,636, up from $27,478 in 2015. But net farm incomes have fallen dramatically since 2007-2012, when farm earnings were general strong.