Update function will modify the file on filesystem

Previously the update function didn't write the new data onto the file, so the persistence was not guaranteed.

I used the array.splice() function to replace the previous object with the new one.