Fix initialization problem with image loading