Reduce generate_image() warnings, minor clean