fixing a bug in generate_images with natural images rescaling