fixed image saving issue