Fixed caching data write bug and abstracted write function from save process handler