fix bug using permanent instead of temp table for dump_period_stories