Reverting the code after releasing the image