Fix random image generation
Format code