fix the image loading issue by using a callback closure instead of an inout parameter