only save data if it changed