made map write to tmp table, then move to output