changed table-writes for filewriting