Fix duplicate variables with identical name