Fix table name generating.
Fix exception in table renaming.