Fixed image generation bug