By Greg Argos

WEST CHESTER, Pa. (CBS) — The senior living facility that went up in flames in West Chester on Thursday night has previously been cited for safety violations.

Over the past 11 years, Barclay Friends has been inspected 39 times.

There have been 14 inspections with safety violations, including the facility’s failure to maintain fire safety doors, failing to secure medical oxygen containers, not properly marking emergency exits, and faulty sprinkler system components.

West Chester Community Steps Up To Help Senior Living Facility Residents Displaced By Fire

All of these issues, however, were fixed, and as of Thursday night, state officials say the building was up to code.

The facility is regulated by both the Pennsylvania Department of Health and the Department of Human Services.

Investigators from both must conduct inspections, at least annually, to ensure the building is up to date on safety and fire prevention regulations known as the life safety code.

The most recent reports from both departments are from October and early November. They show the building is in compliance, even though there are four minor infractions, including a smoke detector too close to the HVAC unit.

PHOTOS: Massive Fire Rips Through West Chester Nursing Home

It’s unclear what caused the fire that injured at least 27 people at the senior living facility and why the building’s sprinkler system didn’t stop it.

The Bureau of Alcohol, Tobacco, Firearms and Explosives is assisting with the investigation.