Duplicate  variable is throwing errors