added checks to showPic( ) function