changed custom post type now $image_attributes[0]; broken

I don’t know what you used to change the slug in the wp-admin, a plugin perhaps?

But I’m not sure if your method will update existing database posts. And if it does the way it did is probably where something went wrong.

What exactly did you use to update your slug in the wp-admin?