Can't add new Application Global State (stateful smart contract)

Hi everyone,

I use stateful smart contract to store my information by setting some variables in Global State. Please see below for details of my problem:

My TEAL code:

#pragma version 2
byte "msig"
txna ApplicationArgs 0
app_global_put

byte "OwnerPercentage_1"
txna ApplicationArgs 1
btoi
app_global_put

byte "OwnerAddress_1"
txna ApplicationArgs 2
app_global_put
int 1
return

My application args:

and these are results I got, that is exactly

My first transaction create app: Algorand Transaction

and then I want to update the value of the variable “OwnerPercentage_1” and add new two variables: “OwnerPercentage_2”, “OwnerAddress_2” so I create the transaction to update my app.

This is my TEAL code:

#pragma version 2
byte "msig"
txna ApplicationArgs 0
app_global_put

byte "OwnerPercentage_1"
txna ApplicationArgs 1
btoi
app_global_put

byte "OwnerAddress_1"
txna ApplicationArgs 2
app_global_put

byte "OwnerPercentage_2"
txna ApplicationArgs 3
btoi
app_global_put

byte "OwnerAddress_2"
txna ApplicationArgs 4
app_global_put
int 1
return

and this is my args

but my results I got only set value for two old variables: “OwnerPercentage_1”, “msig”. Why I cannot add new variables in this transaction?

My second transaction to update app: Algorand Transaction

This is Global State my app after two transactions:

after that, I tried to send again the transaction to update my app (everything is the same as my second transaction) and these are the results I got, that’s exactly

My Application Global State after three transactions:

Anyone can explain to me why I cannot add new variables in 2nd transaction, please?

When you update an application, the old code of the application is executed, not the new code.

Usually, the old code is supposed to verify that the update is allowed.

If you want to execute the new code, you need to make a no-op application call.

Thank you so much, my problem has been resolved.