(Photo: ABC/Giovanni Rufino)

Deadline reports that ABC has granted Quantico a last-minute reprieve, announcing that it’s renewing the espionage series less than 24 hours before the network was set to lock in its 2017-2018 schedule with its upfront presentation in New York. The series will return for a third season this fall, although not without some changes: the new season will be truncated, cut to 13 episodes, and showrunner Josh Safran is stepping down from his role at the head of the show. (Safran will stay on as a consultant, even as the network hunts for his replacement.)

The skin-of-its-teeth rescue is a far cry from Quantico’s initial response; when the show debuted, back in 2015, it was a record-breaking success for the network. But it couldn’t keep up the momentum, and not even the considerable appeal of its most reliable asset—star Priyanka Chopra—could stop the series from hemorrhaging viewers with its tales of undercover cops and terrorist plots. Nevertheless, ABC seems to think the series deserves a second chance, albeit with someone else behind the wheel.