fix wrong temptable index