error checking for showImage function