handled undefined error on rendering current image