better error checking when no images are returned