create image with template and other bug fix