Fixing bug caused by renaming vars