Bug fixes in editing and saving data