When you delete a photo from your iPhone, you expect it to be gone for good. But that’s not what users running iOS 17.5 experienced: After the update, some users found their deleted photos were unexpectedly returning from the grave, with no clear reason why. Understandably, people were concerned (they did delete these photos, after all).

Whatever the cause of the bug, there’s now at least a positive development to report: Today, Apple released iOS 17.5.1, with one note in the changelog: “This update provides important bug fixes and addresses a rare issue where photos that experienced database corruption could reappear in the Photos library even if they were deleted.”

How to stop deleted photos from reappearing on your iPhone

If these release notes are to be believed, once installed, iOS 17.5.1 will stop any deleted photos from reappearing in your library. That’s great news, if perhaps not entirely comforting. With no overt explanation for why this happened in the first place, who’s to say it won’t happen again?

As a reminder, when you delete a photo on from your iPhone, it doesn’t go away immediately. Instead, it hides itself from your Photos library, and ends up in a password or Face ID protected “Recently Deleted” folder for 30 days. You have the month to reverse your decision, and pull it back into your library. However, after those 30 days are up, iOS will permanently delete the photo from your library. (You also have the option to manually erase it from this folder at any time during that month.)

It’s possible some of the photos that reappeared because of this bug were pulled from the Recently Deleted folder. But when it comes to photos that were definitely deleted, there are other possible explanations. After all, any digital file is not typically destroyed immediately after being deleted. Technically, the information—whether a text file or a racy photo—remains on the disc until the system needs that space to store new information, at which point the original data is overwritten. Perhaps iOS mistakenly retrieved this data before it was overwritten? Hard to say, and Apple isn’t telling us.

While there are no guarantees we are free of a bug like this reoccurring, Apple does say this latest update fixes the issue. So if you want to keep deleted photos from reappearing in your Photos library, updating to iOS 17.5.1 is your best bet.

How to update your iPhone to stop deleted photos from reappearing

To update your iPhone to iOS 17.5.1, open Settings > General > Software Update, then follow the on-screen instructions to download and install the update.