replaced tmp table names with real ones