fix problem in image generation