modified model.write_data to correct syntax error.