write local file and update