fixed renaming bug with sql statement.