zgiles: added checks to fail cleanly if no images are available instead of throwing exceptions