typo error : reused same variable name inside function