correct loadImages function