Add fix for the random image generator logic