fixed variable renaming logic.