fix bug on replaceVars