Fixed bug with image generation.