Mint Native Tokens with SDK

So the solution and the problem is the same as here: Failed to deploy contract using typescript sdk - #17 by yuduan0220

The problem is that storage variables are somehow uninitialized.

Here the variable total_supply is somehow uninitialized.

storage {
    total_supply: u64 = 0,
    owner: State = State::Uninitialized,
}

I put this in the constructor

#[storage(read, write)]
    fn constructor(owner_: Identity) {
        storage.total_supply.write(0);
        storage.owner.write(State::Initialized(owner_));
    }

Now everything works fine. Mint function work as intended. Why is that?