bug fix in creating images