change model writer function, when write model to a file save instance number and iterator number