corrected/improved figure saving