fix sql after table renaming