cleanup image tranfser logic