fixed bug (the table name in the query used to get overwritten).