save-raw function updated