finally fixed the image loading segmentation fault