Checking in Retrieve Image complete code - Image gets corrupted