NEWARK, N.J. (AP) — A spate of recent train cancellations plaguing New Jersey Transit commuters is expected to ease before long, but a top official warned Tuesday that disruptions may continue through the end of the year as crews work to install a federally mandated emergency braking system.

Dozens of last-minute train cancellations in recent days have caused havoc on a system that already experiences overcrowding and regular delays because of aging infrastructure.

NJ Transit has attributed the recent problems to an underlying engineer shortage exacerbated by unscheduled engineer absences. Train crews also are being pulled off regular duty to test the braking system, called positive train control.

Executive Director Kevin Corbett said the staffing shortages should ease once vacation season ends, but he added that the need to install PTC by year's end will still be disruptive.

"To get these numbers up with PTC it's going to be a rough fall, no question about it," he said. "But it will gradually get better."

NJ Transit received a two-year extension beyond the initial Dec. 31, 2018 federal deadline, but it has to have all PTC equipment installed by the end of this year so that testing can be performed over the next two years. The system was 52 percent installed by the end of June compared to about 13 percent after the first quarter, Corbett said.

Corbett said he has had "strong talks" with leaders of the engineers' union about the recent absences. A spokesman for the locomotive engineers' union didn't immediately return a message seeking comment.

According to an NJ Transit spokeswoman, the agency is budgeted for 383 engineers but has only 335 on active duty, not including 18 who are on leave. Nine new engineers are starting this week, Corbett said. NJ Transit also is increasing the number of engineer training classes, but those effects won't be felt until next spring.

Meanwhile, rail commuters already facing several years before a new Hudson River rail tunnel is built to increase capacity are bearing the brunt. Eighteen trains were canceled during Friday morning's peak period, followed by 20 on Monday morning and seven on Tuesday morning.

Three-quarters of the Monday cancellations were due to a lack of available engineers, according to NJ Transit spokeswoman Nancy Snyder. The rest were mostly a result of mechanical issues.

More than 100,000 people ride NJ Transit trains from New Jersey to New York, directly or through connections. After his election last fall, Gov. Phil Murphy, a Democrat, called NJ Transit "a national disgrace" and said he would make it a top priority to improve the system's performance.

His first state budget increased operating subsidies for NJ Transit by $242 million, to $383 million, reversing a trend under former Republican Gov. Chris Christie.

But despite Murphy's executive order in January deeming as "irresponsible" Christie's practice of raiding NJ Transit's capital budget to pay for operating costs, NJ Transit was set to vote last month on a budget that would do just that.

The vote was deferred until this month's board meeting, scheduled for Wednesday.

Murphy has been on vacation but is expected to address the transit system's problems when he returns this week. His office didn't immediately comment on the situation Tuesday.