Moved creation of the UIImage from outside the main thread to inside, to avoid CGImageReadSessionGetCachedImageBlockData errors.