Fixed bug where the correct image wasn't always loaded in lightbox.