Fix deletion of old images